bartekd Posted January 7, 2012 Share Posted January 7, 2012 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? Link to comment Share on other sites More sharing options...
MilesAhead Posted January 7, 2012 Share Posted January 7, 2012 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. My Freeware Page Link to comment Share on other sites More sharing options...
bartekd Posted January 7, 2012 Author Share Posted January 7, 2012 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? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2012 Moderators Share Posted January 7, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bartekd Posted January 7, 2012 Author Share Posted January 7, 2012 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2012 Moderators Share Posted January 7, 2012 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. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bartekd Posted January 7, 2012 Author Share Posted January 7, 2012 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2012 Moderators Share Posted January 7, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bartekd Posted January 7, 2012 Author Share Posted January 7, 2012 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. Link to comment Share on other sites More sharing options...
bartekd Posted January 8, 2012 Author Share Posted January 8, 2012 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. Link to comment Share on other sites More sharing options...
MilesAhead Posted January 9, 2012 Share Posted January 9, 2012 As to the HotKey reference, I think MilesAhead was just referring to the UDF where you find the dialog he picturedI 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. My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted January 9, 2012 Share Posted January 9, 2012 (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 January 9, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
bartekd Posted January 10, 2012 Author Share Posted January 10, 2012 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 Link to comment Share on other sites More sharing options...
MilesAhead Posted January 10, 2012 Share Posted January 10, 2012 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. My Freeware Page Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now