1. Win32Lib: onChange Event for List Not Working (?)
- Posted by cklester <cklester at yahoo.com> Nov 16, 2004
- 515 views
- Last edited Nov 17, 2004
Derek, this program demonstrates on my PC that the onChange event for the ListBox is not working as expected. Notice I said "as expected," because maybe my expectations are off a bit. :) When you click the "Add" or "Remove" button, it changes the List. The change in the list should trigger a change in the appearance of the "Next" button... but it doesn't. Any help will be appreciated.
include Win32lib.ew without warning constant Window1 = createEx( Window, "Window1", 0, Default, Default, 276, 168, 0, 0 ) constant bttn_Add = createEx( PushButton, "Add", Window1, 168, 20, 88, 28, 0, 0 ) constant bttn_Remove = createEx( PushButton, "Remove", Window1, 168, 52, 88, 28, 0, 0 ) constant theList = createEx( List, "List of Stuff", Window1, 4, 8, 148, 120, 0, 0 ) constant bttn_Next = createEx( PushButton, "Next -->", Window1, 168, 104, 88, 28, 0, 0 ) sequence alpha alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" setEnable(bttn_Next,w32False) procedure theList_onChange (integer self, integer event, sequence params)--params is () if getCount(self) > 0 then setEnable(bttn_Next,w32True) else setEnable(bttn_Next,w32False) end if end procedure setHandler( theList, w32HChange, routine_id("theList_onChange")) procedure bttn_Add_onClick (integer self, integer event, sequence params)--params is () -- add random item to list addItem(theList, { alpha[rand(length(alpha))] } ) end procedure setHandler( bttn_Add, w32HClick, routine_id("bttn_Add_onClick")) procedure bttn_Remove_onClick (integer self, integer event, sequence params)--params is () integer i i = getCount(theList) if i > 0 then VOID = deleteItem(theList,rand(i)) end if end procedure setHandler( bttn_Remove, w32HClick, routine_id("bttn_Remove_onClick")) WinMain( Window1,Normal )
-=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
2. Re: Win32Lib: onChange Event for List Not Working (?)
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 16, 2004
- 472 views
- Last edited Nov 17, 2004
cklester wrote: > > Derek, this program demonstrates on my PC that the onChange event for the > ListBox is not working as expected. Notice I said "as expected," because > maybe my expectations are off a bit. :) > > When you click the "Add" or "Remove" button, it changes the List. The > change in the list should trigger a change in the appearance of the "Next" > button... but it doesn't. > > Any help will be appreciated. Just change 'w32HChange' to 'w32HDataChange'. The w32HChange detects changes in the selection. In other words, this is fired when the selection changes from one item to another. The w32HDataChange is fired when items are added or deleted from a List or a Combo control. The parameters for the Data Change event are ... { eventqual, index } where eventqual is one of w32CHG_Add = Item added (List & Combo) w32CHG_Del = Item deleted (List & Combo) w32CHG_Chg = Item changed (Combo) and index is the index of the item added/deleted. -- Derek Parnell Melbourne, Australia
3. Re: Win32Lib: onChange Event for List Not Working (?)
- Posted by cklester <cklester at yahoo.com> Nov 17, 2004
- 465 views
Derek Parnell wrote: > cklester wrote: > > When you click the "Add" or "Remove" button, it changes the List. The > > change in the list should trigger a change in the appearance of the "Next" > > button... but it doesn't. > Just change 'w32HChange' to 'w32HDataChange'. Excellent! Thanks. :) -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/