Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

GUI Alpha-Test #2 Version Available


  • Please log in to reply
41 replies to this topic
Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

to be able to display a given element of a listbox or combobox (of course I don't talk about the default element marked by ||)

But the default item (marked by ||) seems to be exactly the same as "being able to display a given element". For example, the item displayed by a DropDownList is the currently selected item.

Note: You can use the commands "Control Choose/ChooseString" to select an item in a DropDownList, ComboBox, or ListBox.

Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004

But the default item (marked by ||) seems to be exactly the same as "being able to display a given element". For example, the item displayed by a DropDownList is the currently selected item.

I am not agree with that, Chris. I explain (better I hope) :
If I have (for example) "Item1||Item2|Item3|Item4|Item5" as the the fixed list of choice of a DropDownList, ComboBox or ListBox control, Item1 will be the item displayed by default.
I think it is not a rather flexible m├ęthod.
In fact, if I want, before displaying the GUI, to have an item other than Item1 selected by default, must I prepare, depending of the value of a variable (named var for example), someting like that :
if var = 1
  gui, add, ListBox,, Item1||Item2|Item3|Item4|Item5
elseif var = 2
  gui, add, ListBox,, Item1|Item2||Item3|Item4|Item5
elseif var = 3
  gui, add, ListBox,, Item1|Item2|Item3||Item4|Item5
elseif var = 4
  gui, add, ListBox,, Item1|Item2|Item3|Item4||Item5
elseif var = 5
  gui, add, ListBox,, Item1|Item2|Item3|Item4|Item5||
????
I think it is not very practical
Would it not be simpler to do someting like that :
gui, add, ListBox, sItem3, Item1|Item2|Item3|Item4|Item5
(sItem3 = select the element of the list named Item3)
or
gui, add, ListBox, s3, Item1|Item2|Item3|Item4|Item5
(s3 = select the 3rd item of the list)
to display by default the 3rd item of the list ?

With this method, you can change before any displaying of the GUI the selected element of the list. This method seems to me more flexible. If I want the 4th element of the list to be selected by defaut :
gui, add, ListBox, sItem4, Item1|Item2|Item3|Item4|Item5

Are you OK with me ?

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Chris, PLEASE make a Radio buttons in the GUI.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004

You can use the commands "Control Choose/ChooseString" to select an item in a DropDownList, ComboBox, or ListBox.


NB : Of course and it's a good thing for the GUI the AHK developper don't create and want to control.

I'm not shure is the best thing for the GUI the AHK developper creates himsel. He should have simpler way to control it's own creation... But that's only my opinion...

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004

With this method, you can change before any displaying of the GUI the selected element of the list. This method seems to me more flexible.

Here is a way you can do it with a variable.
s4 = |

gui, add, ListBox,, Item1|%s1%Item2|%s2%Item3|%s3%Item4|%s4%Item5|%s5%
gui, show,, Test
return
Or if you want it to be easier to specify the variable by the value in another variable:
Selection = 3
Loop
{
  if a_index = %selection%
  {
    s%a_index% = |
    break
  }
}

gui, add, ListBox,, Item1|%s1%Item2|%s2%Item3|%s3%Item4|%s4%Item5|%s5%
gui, show,, Test
return
thanks,
beardboy

Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004
Hi beardboy.

Thanks for this interesting code

If there is not alternative way to do that, it's a good method.

But (I hope you will bre agree with me) "gui, add, ListBox, sItem3, Item1|Item2|Item3|Item4|Item5" (for example) is only one line of code, and seems to me more concise and elegant...

It's only one option the AHK developper can use or not, it doesn't change very much the initial command, and can eventualy replace the double pipe in the list.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

if I want, before displaying the GUI, to have an item other than Item1 selected by default

That's a very good point. It's due to feedback like this that I'm glad I released the alpha-test version. It's helped me smooth out a lot of things, and your comment here seems like a great suggestion.

sItem3 = select the element of the list named Item3

This method can't work very well because items in the flex options list should not contain spaces.

s3 = select the 3rd item of the list

This is much more feasible, but not quite as user friendly. Even so, it might be best. Here is the tentative/planned syntax for an alternate way:
gui, ChooseString, MyList, Item1 ; Change to a different selection.

In any case, I will be acting upon your suggestion, so thanks.

should have simpler way [than Control Choose/ChooseString] to control it's own creation

It's not complete yet; there will be more features and easier ways to do things. I released the gui feature as a prototype to give you and others the means to provide feedback and bug reports, which have been very helpful and I thank everyone involved.

Chris, PLEASE make a Radio buttons in the GUI.

It's high on the list, hopefully within the next 4 days, along with many other improvements.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Cool. Chris, can you make another thing to GUI, a button to hide/show text? Sorry if I'm asking for too much. :oops:

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004

Chris, can you make another thing to GUI, a button to hide/show text?

This can be done with existing commands
gui, add, text,, This text can be hidden.
gui, add, button, w100, Hide
gui, show,, TestGUI
return

ButtonHide:
ControlGet, check, Visible,, Static1, TestGUI
if check = 1
{
  Control, Hide,, Static1, TestGUI
  ControlSetText, Button1, Unhide, TestGUI
}
else
{
  Control, Show,, Static1, TestGUI
  ControlSetText, Button1, Hide, TestGUI
}
return
thanks,
beardboy

Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004

gui, ChooseString, MyList, Item1

I'm OK with that. The most important for me is to have an AHK and a GUI AHK easy to code and efficient.

I released the gui feature as a prototype to give you and others the means to provide feedback and bug reports, which have been very helpful and I thank everyone involved

That's what I try to propose some things. Thanks to take them in account.
For the radio button : Super !!!

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

Chris, can you make another thing to GUI, a button to hide/show text?

This can be done with existing commands


No, I mean to make text appear then hide.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
I'm not sure what you mean then. Do you have an example?

Here's one that while hide and show text over and over, and another line that will just wait and hide it after 2 seconds.
SetTimer, hide, 500
Settimer, hide2, 2000

gui, add, text,, This text will appear and disapear.
gui, add, text,, This text will just disapear.
gui, show,, TestGUI
return

Hide:
ControlGet, check, Visible,, Static1, TestGUI
if check = 1
{
  Control, Hide,, Static1, TestGUI
}
else
{
  Control, Show,, Static1, TestGUI
}
return

Hide2:
Control, Hide,, Static2, TestGUI
SetTimer, hide2, off
return
thanks,
beardboy

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Cool, yea that's something that I wanted.

Tyvm :D

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
More changes have been applied to the following files:
Full Installer at download page (includes everything except demo scripts & SmartGUI)
ZIP file containing only the updated EXE and demo scripts (163 KB)
Demo scripts only (10 KB)
Rajat's SmartGUI Creator (a great layout editor), is also described and available here.

LATEST CHANGES
Made the following controls wrap to a new line if linefeeds (`n) are present in the text, or if the text is too large to fit in the specified width: Buttons, CheckBoxes, Radios, and GroupBoxes.

Improved automatic control positioning and sizing.

X+n and Y+n always use the right or bottom side of the previous control, respectively, rather than the maximum x-extent or y-extent previously reached.

Text and Picture controls can have an associated subroutine, launched when the user clicks on them.

Added option "Choose" to DropDownList/ListBox/ComboBox, which pre-selects a certain item. [thanks Nemroth]

Added options to Checkbox: 1) specify the word Checked or CheckedGray or to start it off checked; 2) specify the word Check3 to enable a third state (gray/indeterminate).

Fixed minor bugs relating to font and color, and possibly other things.

Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004
I dowloaded the last version of the Installer & GUI.
At the line :
gui, add, edit, w90 vRP_GEDD gRP_GEDD
I get the error message :
"This control type should not have an associated subroutine. The current thread will exit."
It isn't possible anymore to attach a gosub procedure to an edit control or is it a bug ?
(This line worked with the precedent download and the RP_GEDD label exist)
Thanks for answer