Re: Win32lib Buttons
- Posted by Mario Steele <eumario at tuscanchat.com> Apr 10, 2004
- 472 views
Guest Wrote: > I want buttons (any button) to be able to be pushed pressing enter key if they get focus, that is, > making DefPushButtons dinamic. This part is a easy one. without warning include win32lib.ew constant mywin = create(Window,"Test Button",0,Default,Default,300,200,0), myButtA = create(PushButton,"Button A",mywin,0,0,80,20,0), myButtB = create(PushButton,"Button B",mywin,0,20,80,20,0) object void procedure onKeyDown_myButtAB(integer id, integer event, sequence param) if param[1] = VK_RETURN then void = invokeHandler(id,w32HClick,{}) end if end procedure setHandler({myButtA,myButtB},w32HKeyDown,routine_id("onKeyDown_myButtAB")) procedure onClick_myButtA(integer id, integer event, sequence param) void = message_box("Ouch, that hurts!","Button A",0) end procedure setHandler(myButtA,w32HClick,routine_id("onClick_myButtA")) procedure onClick_myButtB(integer id, integer event, sequence param) void = message_box("*giggle* That tickles!","Button B",0) end procedure setHandler(myButtB,w32HClick,routine_id("onClick_myButtB")) WinMain(mywin,Normal) Hope this helps, EuMario