footswitch Posted July 12, 2011 Share Posted July 12, 2011 (edited) Hi there,I'm building a script where I have a GUI with a ListView in it (created using _GUICtrlListView_Create()).I also need to know which row a user clicks in the ListView, so I can update a series of GUI controls with information regarding that row.So I registered the WM_NOTIFY callback function after creating the ListView: GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY").It would seem to me that whatever I need to do when a row is clicked - either get row information or set other controls - would have to be coded inside WM_NOTIFY.But while I was experimenting with it, it happened that calling _ArrayDisplay() inside WM_NOTIFY causes the script to freeze.I'd be grateful for your input as to what would be the correct approach to the callback function:- Is it safe to call other functions from within WM_NOTIFY? (apart from some exceptions such as _ArrayDisplay?)- Or should I be using a different approach?Thanks in advance,footswitch Edited July 12, 2011 by footswitch Link to comment Share on other sites More sharing options...
GEOSoft Posted July 12, 2011 Share Posted July 12, 2011 _ArrayDisplay() is simply a debugging function and should not be used as part of a script. Just create your own ListView Control and use that instead. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 12, 2011 Moderators Share Posted July 12, 2011 footswitch,The big problem with calling _ArrayDisplay within the handler is that it is a blocking function - i.e. it waits for user input before letting the script continue. As you can read in the Help file for GUIRegisterMsg:"Warning: blocking of running user functions which executes window messages with commands such as "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!!"If you want to use such a function, set a flag within the handler and then call the blocking function from within your main script. The GUIRegisterMsg tutorial in the Wiki shows how to do this - and offers an alternative solution. 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...
footswitch Posted July 12, 2011 Author Share Posted July 12, 2011 Oh! I believe you guys have a point there. Didn't remember to take a look at GUIRegisterMsg() in the helpfile. My bad. Nevertheless, I was actually using _ArrayDisplay() for debugging So, you'd say it's best (a.k.a. safest) to use flags and look for them in the main loop, rather thank including the control update functions and SQLite Queries inside the callback function, right? Because at times that could take a second or two. Thank you kindly for your advice. footswitch Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 12, 2011 Moderators Share Posted July 12, 2011 footswitch, use flags and look for them in the main loop [...] Because at times that could take a second or twoYou must have a very slow loop! I use the flag technique regularly and I have not noticed any serious delays. Certainly I try and keep the code inside the handler to an absolute minimum - I take the "as fast as possible"suggestion very seriously. 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...
footswitch Posted July 12, 2011 Author Share Posted July 12, 2011 No, not the main loop! I meant the SQLite Query that I need to call when I click a row takes some time to return its result It's a fairly big database with tens of thousands of rows. Loads of compound queries, table joins and conditions. But that's a whole 'nother matter Got it, as fast as possible. Thanks a lot, you guys are the best [place "praise" emoticon here] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 12, 2011 Moderators Share Posted July 12, 2011 footswitch, Sorry, I completely misread your comment! I was just wondering what size of loop you had! 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...
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