Trapping virtual keys in combo boxes

new topic     » topic index » view thread      » older message » newer message

I cannot seem to make windows ignore the pagedown key in a combobox
after processing it myself. Below is a test program showing how far I
got. I can trap '+' (via w32HKeyDown), ignore it, or set the combobox
to "plus". I can trap pagedown (via w32HKeyPress) (if you press
pagedown twice, "pagedown" does appear) but cannot stop windows
selecting "error" from the dropdown. I have also tried manually
resetting it in the onchange event, also with a returnValue(-1) to no
avail. Can anyone help me please? If I can't trap it like this, where
would be a good place to reset it later?
I get the same results using win32lib  0.57.12,  55.5, and 55.1

Pete

include win32lib.ew

constant MAIN =3D create(Window,"Main",0,0,0,Default,Default,0),
		 Cbox =3D create(ComboBox,"",MAIN,220,4,120,340,0)

constant Cstrings =3D {"start","error"}
	addItem(Cbox,Cstrings)
	setIndex(Cbox,1)

procedure onkeydown(integer self, integer event, sequence params)
integer keycode
	keycode=3Dparams[1]
	if keycode=3D'+' then
--		setText(Cbox,"plus")
		returnValue(-1)
	end if
	if keycode=3DVK_PAGEDOWN then
		setText(Cbox,"pagedown")
		returnValue(-1)	-- ineffective
	end if
end procedure
integer Ctxt	-- the editbox child control of the ComboBox
sequence void
	void =3D findChildren(Cbox)
	Ctxt=3Dvoid[1][1]
constant controllist=3D{MAIN,Cbox,Ctxt}
setHandler(controllist,{w32HKeyDown,w32HKeyPress},
routine_id("onkeydown"))

	WinMain(MAIN,Normal)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu