Sign in to follow this  
Followers 0
bartekd

Input box that has a drop down

14 posts in this topic

Hello All

I have a gui that has allot of lines of code, and I want to replace the input boxes with a dropdown input box that opens on the screen (similar to the existing inputbox). Instead of me typing into the input box everytime, I want to be able to select from a dropdown list (combo).

Is there an easy way to do this?

Share this post


Link to post
Share on other sites



Might be better asked in the Gui Help and Support forum. But one way would be to use Koda to create a dialog with a combo box. Just use labels to take the place of prompt and other text of InputBox.

Here's a Set Hotkey dialog that pops up when the user click Set Hotkey in the Tray Menu.

Only thing when you do a dialog is you pretty much have to custom tune it since you use labels instead of InputBox doing the stuff for you. To fill the combobox with a bunch of items separate the strings with a vertical bar like "one|two|three|" and pass it into the combo creation function.

post-31149-0-07009700-1325916586_thumb.j

Share this post


Link to post
Share on other sites

I tried creating a second gui, and adding it to my gui. BUt after I click ok on my second gui (with the dropdown) it dissapears (which is good) but my original gui will not work anymore.

What did you mean by hotkey?

Share this post


Link to post
Share on other sites

bartekd,

Take a look at the Managing Multiple GUIs tutorial in the Wiki to see how get over your GUI problem. If you still have difficulties, just post the code and we will take a look. :)

As to the HotKey reference, I think MilesAhead was just referring to the UDF where you find the dialog he pictured. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

NOw, I am having a different issue. Before I didn't have my gui in a function. so after I did this, all the variables that I set that I didn't make global are not found in other functions. Is that a way that I can make all my variables global within a function? There is hundreds of variables that I have in my script that I will need to make global.

Share this post


Link to post
Share on other sites

bartekd,

If you really have "hundreds of variables" that you need to make Global in scope then you should rewrite your script. ;)

The reason that AutoIt has 2 scopes and the ByRef parameter operator is to help limit the number of Global variables. Having too many is very bad coding practice as you are very likely to end up overwriting one of them by mistake. In AutoIt it is almost impossible to avoid "any" Global variables - things like message handlers, Adlib functions and the like really do need them - but "hundreds" of them is not a good idea at all. :)

Sorry to be so negative, but just adding all your variables as Global at the top of your script is NOT the correct solution, which is rewriting the script so you do not need them all. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

There are lots of variables in my main gui because of all the buttons, inputs, combos, checkboxes, edits etc. Each of these has their own variable. My gui has allot of functions, so I don't think there is another way. Re-writing my gui would not help as I would still have the same ammount of things in my gui.

Share this post


Link to post
Share on other sites

bartekd,

I did not say that you cannot make all your varibales Global, I said that you should not. But do look at passing ControlIDs, etc, as parameters when you call functions - that is why the language has that possibility. :)

Good luck - and do not forget to check for the same names in different functions that are separate variables. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

OK Thanks Melba. Looks like I am stuck setting allot of my variables as global...

If anyone has any other suggestions, please add them to this thread.

Share this post


Link to post
Share on other sites

Thanks All, I figured it out. I have ran my script and saw which variables are called in other functions. Those are the only ones I needed to change to global variables. So now I am able to create a second gui.

Share this post


Link to post
Share on other sites

As to the HotKey reference, I think MilesAhead was just referring to the UDF where you find the dialog he pictured

I used Koda to design a dialog with a couple of combo boxes so that the user can set a hotkey. Then I added a bit of eye candy with thick glass border for Vista. The function comes in handy. I did a similar one to allow the user to select the background color of the form if running on Vista or later. What I like about that dialog is the dialog itself changes background color to preview the color selected by the user.

post-31149-0-48960200-1326081215_thumb.j

post-31149-0-62178600-1326081223_thumb.j

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks All, I figured it out. I have ran my script and saw which variables are called in other functions. Those are the only ones I needed to change to global variables. So now I am able to create a second gui.

I do the same thing. Maybe $Form1 and an Input need to be accessible globally in my apps.

Edited by MilesAhead

Share this post


Link to post
Share on other sites

I used Koda to design a dialog with a couple of combo boxes so that the user can set a hotkey. Then I added a bit of eye candy with thick glass border for Vista. The function comes in handy. I did a similar one to allow the user to select the background color of the form if running on Vista or later. What I like about that dialog is the dialog itself changes background color to preview the color selected by the user.

Nice, that looks good. Thanks MilesAhead

Share this post


Link to post
Share on other sites

If you search the forums you can find function _Vista_ApplyGlassArea() by James Brooks. Also you can find code for Windows7 Transparency. But controls on top of glass is a pita to be honest. :) If you just do a glassy border then most things work normally inside the dialog. Here's a recent folder utility I did that looks glassy because I made the left border thick by offsetting the controls a bit. But I didn't have to do anything exotic with the controls. They work normally.

Posted Image

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0