Vadtec Posted March 27, 2012 Share Posted March 27, 2012 (edited) Greetings all. I have an idea, but I'm not exactly sure how to go about making it work. Basically, I have an app running in GUIOnEventMode, but I need to be able to respond to keystrokes without using an edit box. The idea is, the app is a window with buttons on it. Based on the task at hand, the buttons/layout change to present the correct options to the user. Currently I have it setup where after each use of the app, it defaults to a "start screen" where the user can select the correct button layout as necessary. My problem is I need a way to change from layout to layout in a few specific cases. Using buttons to go forward and backward is cumbersome at best. I am trying to figure out a way that I can trap keystrokes in OnEvent mode that can be used to change the screens as necessary. How can I trap keystrokes when there is no edit box to type in? I've done this in C++/C# apps in the past, just not sure how to do it in AI when in OnEvent mode. I would really like to avoid message mode as I would end up having to re-write the entire app, which really isn't an option right now. Any help is greatly appreciated. - Vadtec Edited March 27, 2012 by Vadtec Link to comment Share on other sites More sharing options...
Vadtec Posted March 27, 2012 Author Share Posted March 27, 2012 After looking at the message loop docs...is it even possible to trap keystrokes in this manner in AI? - Vadtec Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 27, 2012 Moderators Share Posted March 27, 2012 Vadtec,It might just be me, but I found your explanation as clear as mud! I seem to understand that you want to change the layout of the buttons on your GUI without using one of the buttons to do it. Why not look at GUISetAccelerators? You can set keys to run functions when pressed - a bit like a HotKey but only active when your GUI is active. If I have got the wrong end of the stick, could you please post a short reproducer of what you are trying to do. 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...
Vadtec Posted March 27, 2012 Author Share Posted March 27, 2012 Melba23, Maybe this explanation will be more clear: Think of this app as a menu driven interface, akin to old menu based console apps. Each button leads to a sub menu, which leads to different screens/menus/options/etc. What I want is to let the user be able to type (for example) "1234<enter>" to get to whatever screen clicking the buttons to achive "1234" would take them to. As a more specific example, one of the most common screens the users go to is called the "445A" screen. Basically, from the "start screen" the user presss the button labled "Menu 4", then the button labled "Option 4", then the button "Option 5", then the button "Option A". I'm trying to make it so that, without needing an input box of some sort, from the start screen the user simply types "445A<enter>" which is captured by the program and takes them directly to the screen in question. I'm browsing the forums and Google, but alas I don't think this is easily achiveable in AI. Maybe I'm wrong. - Vadtec Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 27, 2012 Moderators Share Posted March 27, 2012 Vadtec, Take a look at the Hot Strings UDF - that might solve your problem. 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...
Vadtec Posted March 27, 2012 Author Share Posted March 27, 2012 Melba23, Many thanks! I should be able to deconstruct that UDF to fit my exact needs. Might also learn some more hard core stuff about AI along the way too. - Vadtec Link to comment Share on other sites More sharing options...
Vadtec Posted March 27, 2012 Author Share Posted March 27, 2012 One nuance I've discovered: When using this method in OnEvent mode, it does not allow the button clicks to be captured normally. I am not sure why this is, but I had to make some minor chages to the HotStrings code provided above. If I come up with a solution to the bug I'll let ya know. - Vadtec 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