Re: onClick_Listbox ?
- Posted by Irv Mullins <irv at ELLIJAY.COM> Dec 18, 1999
- 453 views
From: Robert Pilkington <pilking at BELLATLANTIC.NET> Subject: onClick_Listbox ? > I need to have a listbox in Win32Lib. When I click on one of the items, I > need it to trigger an event. Using onClick[thelistbox] = > routine_id("thisroutine")doesn't seem to call thisroutine when I click on an > item, so I was wondering how could I do it? Hi Robert: You need to put your code in the on_change response, e.g: -- code generated by Win32Lib IDE v0.8 include Win32Lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window1 global constant Window1 = create( Window, "The Window", 0, Default, Default, 350, 250+ 19, 0 ) global constant List1 = create( List, "List1", Window1, 81, 37, 150, 120, 0 ) global constant LText2 = create( LText, "LText2", Window1, 32, 196, 280, 24, 0 ) ---------------------------------------------------------------------------- ---- procedure Window1_onOpen () addItem(List1,"One") addItem(List1,"Two") addItem(List1,"Three") end procedure onOpen[Window1] = routine_id("Window1_onOpen") ---------------------------------------------------------------------------- ---- procedure List1_onChange () setText(LText2, sprintf("You chose %d",getIndex(List1))) end procedure onChange[List1] = routine_id("List1_onChange") ---------------------------------------------------------------------------- ---- WinMain( Window1, Normal ) Regards, Irv