1. Can't trap the down arrow key
- Posted by Ron Austin <ronaustin at alltel.net> Nov 25, 2003
- 395 views
I want to use the up and down arrows to scroll back and forth through a file, but I can't seem to get the up and down arrows to do anything. I have a screen with six LText controls, Diag[1] thru Diag[6}. Here's the code I used to see if my program recognized the down arrow key: onKeyDown[Diag[1]] = routine_id("onKeyDown_Win") onKeyDown[Diag[2]] = routine_id("onKeyDown_Win") onKeyDown[Diag[3]] = routine_id("onKeyDown_Win") onKeyDown[Diag[4]] = routine_id("onKeyDown_Win") onKeyDown[Diag[5]] = routine_id("onKeyDown_Win") onKeyDown[Diag[6]] = routine_id("onKeyDown_Win") procedure OnKeyDown_Win(integer key, integer shift) setText(Diag[2],"Gotcha") if key = VK_DOWN then setText(Diag[2],"Gotcha Again") end if end procedure Neither "Gotcha" or "Gotcha Again" show up on the screen. What do you suppose the problem is?
2. Re: Can't trap the down arrow key
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Nov 25, 2003
- 436 views
----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Subject: Can't trap the down arrow key > > > I want to use the up and down arrows to scroll back and forth through a > file, but I can't seem to get the up and down arrows to do anything. I > have a screen with six LText controls, Diag[1] thru Diag[6}. Here's the > code I used to see if my program recognized the down arrow key: > > onKeyDown[Diag[1]] = routine_id("onKeyDown_Win") > onKeyDown[Diag[2]] = routine_id("onKeyDown_Win") > onKeyDown[Diag[3]] = routine_id("onKeyDown_Win") > onKeyDown[Diag[4]] = routine_id("onKeyDown_Win") > onKeyDown[Diag[5]] = routine_id("onKeyDown_Win") > onKeyDown[Diag[6]] = routine_id("onKeyDown_Win") > > procedure OnKeyDown_Win(integer key, integer shift) > > setText(Diag[2],"Gotcha") > > if key = VK_DOWN then > setText(Diag[2],"Gotcha Again") > end if > end procedure > > Neither "Gotcha" or "Gotcha Again" show up on the screen. What do you > suppose the problem is? LText controls never receive keyboard events. There are meant to be used as labels and not input fields. The field that has focus will receive the keyboard events. You might like to use a List control instead to store the lines of text. For example ... ----------- include win32lib.ew without warning constant Win = create(Window, "Scroll Text", 0, 0, 0, 420, 400, 0), FileName = create(EditText, "C:\\autoexec.bat", Win ,5, 5, 350, 20, 0), GetIt = create(DefPushButton, "Load", Win, 360, 5, 40, 20, 0), TextArea = create(List, "", Win, 5, 35, 350, 6*(2+getTextHeight(Win, "|")), 0) procedure InitApp(sequence pFileName) integer fh object lLine eraseItems(TextArea) fh = open(pFileName, "r") if fh = -1 then return end if lLine = gets(fh) while sequence(lLine) do if lLine[length(lLine)] = '\n' then lLine=lLine[1..length(lLine)-1] end if addItem(TextArea, lLine) doEvents(0) lLine = gets(fh) end while close(fh) lLine = getItem(TextArea,1) setFocus(TextArea) end procedure procedure Click_GetIt(integer self, integer event, sequence parms) InitApp( getText(FileName) ) end procedure setHandler(GetIt, w32HClick, routine_id("Click_GetIt")) WinMain(Win, Normal) ----------- And by the way, can I recommend that you do not use the onXXX[] interface but instead use the setHandler() interface. -- Derek
3. Re: Can't trap the down arrow key
- Posted by "Greg Haberek" <g.haberek at comcast.net> Nov 25, 2003
- 408 views
> Neither "Gotcha" or "Gotcha Again" show up on the screen. What do you > suppose the problem is? LText, CText and RText controls don't respond to events. Try trapping the events through your main window. Also, try using setHandler() rather than onXXX, since onXXX is disabled in Win32Lib unless you enable it. ~Greg
4. Re: Can't trap the down arrow key
- Posted by "Greg Haberek" <g.haberek at comcast.net> Nov 25, 2003
- 395 views
Were you using onKeyPress or onKeyDown? the KeyPress event only responds to 'printable' keys, like 'A' 'F' 'X' or whatever. special keys respond to the KeyDown and KeyUp event, like VK_UP, VK_DOWN, etc... hope this helps, its a full working demo of trapping the up and down keys. -- begin code -- include Win32Lib.ew without warning constant Win = create(Window,"Test",0,Center,Center,0.5,0.5,0), Lbl1 = create(LText,"Code",Win,20,50,60,20,0), Lbl2 = create(LText,"Description",Win,20,80,60,20,0), Lbl3 = create(LText,"Category 1",Win,20,110,60,20,0), Lbl4 = create(LText,"Category 2",Win,20,140,60,20,0), Lbl5 = create(LText,"Category 3",Win,20,170,60,20,0), Lbl6 = create(LText,"Rank",Win,20,200,60,20,0), T_Code = "Code", T_Desc = "Description", T_Cat = "Category", T_Rank = "Rank" sequence Diag Diag = repeat(0,6) Diag[1] = create(EditText,{"",T_Code},Win,100,50,42,20,ES_UPPERCASE) Diag[2] = create(EditText,{"",T_Desc},Win,100,80,278,20,ES_UPPERCASE) Diag[3] = create(EditText,{"",T_Cat},Win,100,110,148,20,ES_UPPERCASE) Diag[4] = create(EditText,{"",T_Cat},Win,100,140,148,20,ES_UPPERCASE) Diag[5] = create(EditText,{"",T_Cat},Win,100,170,148,20,ES_UPPERCASE) Diag[6] = create(EditText,{"",T_Rank},Win,100,200,20,20,ES_UPPERCASE) setWindowBackColor(Win,rgb(155,255,255)) procedure Diag_onKeyDown( integer self, integer event, sequence params ) -- example of how the up and down keys can move between EditText boxes integer pos if params[1] = VK_DOWN then pos = find(self, Diag) if pos = length(Diag) then pos = 1 elsif pos > 0 then pos += 1 else return -- error end if setFocus( Diag[pos] ) elsif params[1] = VK_UP then pos = find(self, Diag) if pos = 1 then pos = length(Diag) elsif pos > 1 then pos -= 1 else return -- error end if setFocus( Diag[pos] ) end if end procedure setHandler( Diag, w32HKeyDown, routine_id("Diag_onKeyDown") ) WinMain( Win, Normal ) -- end code -- ~Greg
5. Re: Can't trap the down arrow key
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Nov 25, 2003
- 387 views
----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Subject: RE: Can't trap the down arrow key > > > Tommy Carlier wrote: > > > > > > Ron Austin wrote: > > > > > > > > > I want to use the up and down arrows to scroll back and forth through a > > > file, but I can't seem to get the up and down arrows to do anything. I > > > have a screen with six LText controls, Diag[1] thru Diag[6}. Here's the > > > > > > > > > code I used to see if my program recognized the down arrow key: > > > > > > onKeyDown[Diag[1]] = routine_id("onKeyDown_Win") > > > onKeyDown[Diag[2]] = routine_id("onKeyDown_Win") > > > onKeyDown[Diag[3]] = routine_id("onKeyDown_Win") > > > onKeyDown[Diag[4]] = routine_id("onKeyDown_Win") > > > onKeyDown[Diag[5]] = routine_id("onKeyDown_Win") > > > onKeyDown[Diag[6]] = routine_id("onKeyDown_Win") > > > > > > procedure OnKeyDown_Win(integer key, integer shift) > > > > > > setText(Diag[2],"Gotcha") > > > > > > if key = VK_DOWN then > > > setText(Diag[2],"Gotcha Again") > > > end if > > > end procedure > > > > > > Neither "Gotcha" or "Gotcha Again" show up on the screen. What do you > > > suppose the problem is? > > > > > > > Derek and Greg gave you the right solution, but I also noticed that you > > used routine_id("onKeyDown_Win") before you defined the procedure. > > Couldn't that also cause problems, or is it just in this example and not > > > > in your code? > > > > ______________ > > tommy online: http://users.pandora.be/tommycarlier > > > Sorry for the confusion. Let me start again. Here's my input section: > > constant > Lbl1 = create(LText,"Code",Win,20,50,60,20,0), > Lbl2 = create(LText,"Description",Win,20,80,60,20,0), > Lbl3 = create(LText,"Category 1",Win,20,110,60,20,0), > Lbl4 = create(LText,"Category 2",Win,20,140,60,20,0), > Lbl5 = create(LText,"Category 3",Win,20,170,60,20,0), > Lbl6 = create(LText,"Rank",Win,20,200,60,20,0) > > Diag[1] = create(EditText,{"",T_Code},Win,100,50,42,20,ES_UPPERCASE) > Diag[2] = create(EditText,{"",T_Desc},Win,100,80,278,20,ES_UPPERCASE) > Diag[3] = create(EditText,{"",T_Cat},Win,100,110,148,20,ES_UPPERCASE) > Diag[4] = create(EditText,{"",T_Cat},Win,100,140,148,20,ES_UPPERCASE) > Diag[5] = create(EditText,{"",T_Cat},Win,100,170,148,20,ES_UPPERCASE) > Diag[6] = create(EditText,{"",T_Rank},Win,100,200,20,20,ES_UPPERCASE) > setWindowBackColor(Win,rgb(155,255,255)) > > I said LText when I should have said EditText. What I want to do is get > a record and display it (I already can do this), and then when I hit the > up or down arrow it will get the next record or previous record and > display it on the screen. The Tsunami file system that I use can do > this. The main problem is that my procedure for detecting that the up > and down arrow keys was hit don't work. I did a search and found > someone who had the same problem and I pulled the code I used right off > this forum. I switched the code around to define the procedure before I > used the routine_id as Tommy suggested, but that didn't help. I sure > would like to get this working. > Okay! Now this is a lot different from your first description. Detail helps, no? I suspect that all you have to do is ... setHandler(Screen, w32HKeyDown, routine_id("my down key routine name")) And inside that handler code, you may have to check that whatever control actually has focus, does not 'need' the arrow down/up key for its own purposes - eg. a MleText or List field. Why will this work? Because the Screen control is used to trap events regardless of which control the event actually applies to. It is used to trap all events, not just those for a specific control. I suggest this because it sounds like you don't care which control has focus when the down arrow is pressed, so long as the next record is read in and displayed. -- Derek
6. Re: Can't trap the down arrow key
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 25, 2003
- 389 views
On Tue, 25 Nov 2003 15:18:19 +0000, Ron Austin <ronaustin at alltel.net> wrote: <snip> >I sure would like to get this working. I've reworked the code snippets supplied with a few stolen lines from one of my previous projects. There is an invokeHandler example as well, as suggested by Patrick Barnes: -- code begins -- include win32lib.ew sequence Diag Diag=repeat(0,6) constant Win = create(Window,"Test",0,200,200,400,350,0), Lbl1 = create(LText,"Code",Win,20,50,60,20,0), Lbl2 = create(LText,"Description",Win,20,80,60,20,0), Lbl3 = create(LText,"Category 1",Win,20,110,60,20,0), Lbl4 = create(LText,"Category 2",Win,20,140,60,20,0), Lbl5 = create(LText,"Category 3",Win,20,170,60,20,0), Lbl6 = create(LText,"Rank",Win,20,200,60,20,0), T_Code="A tooltip", T_Desc=T_Code, T_Cat=T_Code, T_Rank=T_Code Diag[1] = create(EditText,{"",T_Code},Win,100,50,42,20,ES_UPPERCASE) Diag[2] = create(EditText,{"",T_Desc},Win,100,80,278,20,ES_UPPERCASE) Diag[3] = create(EditText,{"",T_Cat},Win,100,110,148,20,ES_UPPERCASE) Diag[4] = create(EditText,{"",T_Cat},Win,100,140,148,20,ES_UPPERCASE) Diag[5] = create(EditText,{"",T_Cat},Win,100,170,148,20,ES_UPPERCASE) Diag[6] = create(EditText,{"",T_Rank},Win,100,200,20,20,ES_UPPERCASE) setWindowBackColor(Win,rgb(155,255,255)) integer start start=0 procedure onKeyWin(integer self, integer event, sequence params) if self or event then end if -- suppress warnings if find(params[1],{VK_ENTER,VK_ESCAPE}) then closeWindow(Win) end if if params[1] = VK_DOWN then -- next day start+=1 end if if params[1] = VK_PAGEDOWN then -- next month start+=50 end if if params[1] = VK_UP then -- prev. day start-=1 end if if params[1] = VK_PAGEUP then -- prev month start-=50 end if for i=1 to 6 do setText(Diag[i],sprintf("%d",start)) end for end procedure setHandler(Diag,w32HKeyDown,routine_id("onKeyWin")) if invokeHandler(Diag[1],w32HKeyDown,{VK_DOWN,0}) then end if WinMain(Win,Normal) -- code ends -- Hope you like it, Pete http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html
7. Re: Can't trap the down arrow key
- Posted by "Ron Austin" <ronaustin at alltel.net> Nov 25, 2003
- 407 views
--------------Boundary-00=3D_SBJX6LZ712S000000000 charset=3D"Windows-1252" =0D =0D -------Original Message-------=0D =0D From: EUforum at topica.com=0D Date: Tuesday, November 25, 2003 5:30:20 PM=0D To: EUforum at topica.com=0D Subject: Re: Can't trap the down arrow key=0D =0D =0D =0D Were you using onKeyPress or onKeyDown? the KeyPress event only responds to= =0D 'printable' keys, like 'A' 'F' 'X' or whatever. special keys respond to the= =0D KeyDown and KeyUp event, like VK_UP, VK_DOWN, etc... hope this helps, its a= =0D full working demo of trapping the up and down keys.=0D =0D -- begin code --=0D include Win32Lib.ew=0D without warning=0D =0D constant=0D Win =3D create(Window,"Test",0,Center,Center,0.5,0.5,0),=0D Lbl1 =3D create(LText,"Code",Win,20,50,60,20,0),=0D Lbl2 =3D create(LText,"Description",Win,20,80,60,20,0),=0D Lbl3 =3D create(LText,"Category 1",Win,20,110,60,20,0),=0D Lbl4 =3D create(LText,"Category 2",Win,20,140,60,20,0),=0D Lbl5 =3D create(LText,"Category 3",Win,20,170,60,20,0),=0D Lbl6 =3D create(LText,"Rank",Win,20,200,60,20,0),=0D =0D T_Code =3D "Code",=0D T_Desc =3D "Description",=0D T_Cat =3D "Category",=0D T_Rank =3D "Rank"=0D =0D sequence Diag=0D Diag =3D repeat(0,6)=0D Diag[1] =3D create(EditText,{"",T_Code},Win,100,50,42,20,ES_UPPERCASE)=0D Diag[2] =3D create(EditText,{"",T_Desc},Win,100,80,278,20,ES_UPPERCASE)=0D Diag[3] =3D create(EditText,{"",T_Cat},Win,100,110,148,20,ES_UPPERCASE)=0D Diag[4] =3D create(EditText,{"",T_Cat},Win,100,140,148,20,ES_UPPERCASE)=0D Diag[5] =3D create(EditText,{"",T_Cat},Win,100,170,148,20,ES_UPPERCASE)=0D Diag[6] =3D create(EditText,{"",T_Rank},Win,100,200,20,20,ES_UPPERCASE)=0D =0D setWindowBackColor(Win,rgb(155,255,255))=0D =0D procedure Diag_onKeyDown( integer self, integer event, sequence params )= =0D -- example of how the up and down keys can move between EditText boxes=0D integer pos=0D if params[1] =3D VK_DOWN then=0D pos =3D find(self, Diag)=0D if pos =3D length(Diag) then=0D pos =3D 1=0D elsif pos > 0 then=0D pos +=3D 1=0D else=0D return -- error=0D end if=0D setFocus( Diag[pos] )=0D elsif params[1] =3D VK_UP then=0D pos =3D find(self, Diag)=0D if pos =3D 1 then=0D pos =3D length(Diag)=0D elsif pos > 1 then=0D pos -=3D 1=0D else=0D return -- error=0D end if=0D setFocus( Diag[pos] )=0D end if=0D end procedure=0D setHandler( Diag, w32HKeyDown, routine_id("Diag_onKeyDown") )=0D =0D WinMain( Win, Normal )=0D -- end code --=0D =0D ~Greg=0D =0D Thanks for replying Greg. I have already fixed it by changing from the ol= d onXXX method to the sethandler method. I am changing the routine to look for the page up and page down keys to get next and previous records and I will incorporate your code so that the operator can navigate up and down through Diag[1] to Diag[6].=0D =0D =0D Or send an email to: EUforum-unsubscribe at topica.com=0D =0D TOPICA - Start your own email discussion group. FREE!=0D =0D =0D =0D =0D .=20 --------------Boundary-00=3D_SBJX6LZ712S000000000 Content-Type: Text/HTML; charset=3D"Windows-1252" Content-Transfer-Encoding: 8bit <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3DWindows-125= 2"> <META content=3D"IncrediMail 1.0" name=3DGENERATOR> <!--IncrdiXMLRemarkStart> <IncrdiX-Info> <X-FID>FLAVOR00-NONE-0000-0000-000000000000</X-FID> <X-FVER></X-FVER> <X-CNT>;</X-CNT> </IncrdiX-Info> <IncrdiXMLRemarkEnd--> </HEAD> <BODY style=3D"BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 12pt; MARGIN: 5px 1= 0px 10px; FONT-FAMILY: Arial" bgColor=3D#ffffff background=3D"" scroll=3Dye= s ORGYPOS=3D"0" X-FVER=3D"3.0"> <TABLE id=3DINCREDIMAINTABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%"= border=3D0> <TBODY> <TR> <TD id=3DINCREDITEXTREGION style=3D"FONT-SIZE: 12pt; CURSOR: auto; FONT-FAM= ILY: Arial" width=3D"100%"> <DIV><BR> </DIV> <DIV id=3DIncrediOriginalMessage><I>-------Original Message-------</I></DIV= > <DIV> </DIV> <DIV id=3Dreceivestrings> <DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>From:</B></I> <A href=3D"mai= lto:EUforum at topica.com">EUforum at topica.com</A></DIV> <DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Date:</B></I> Tuesday, Novem= ber 25, 2003 5:30:20 PM</DIV> <DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>To:</B></I> <A href=3D"mailt= o:EUforum at topica.com">EUforum at topica.com</A></DIV> <DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Subject:</B></I> Re: Can't t= rap the down arrow key</DIV></DIV> <DIV> </DIV> <DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The Euphoria Mailing List =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D <BR><BR><BR>Were you using onKeyPress or onK= eyDown? the KeyPress event only responds to<BR>'printable' keys, like 'A' '= F' 'X' or whatever. special keys respond to the<BR>KeyDown and KeyUp event,= like VK_UP, VK_DOWN, etc... hope this helps, its a<BR>full working demo of= trapping the up and down keys.<BR><BR>-- begin code --<BR>include Win32Lib= .ew<BR>without warning<BR><BR>constant<BR>Win =3D create(Window,"Test",0,Ce= nter,Center,0.5,0.5,0),<BR>Lbl1 =3D create(LText,"Code",Win,20,50,60,20,0),= <BR>Lbl2 =3D create(LText,"Description",Win,20,80,60,20,0),<BR>Lbl3 =3D cre= ate(LText,"Category 1",Win,20,110,60,20,0),<BR>Lbl4 =3D create(LText,"Categ= ory 2",Win,20,140,60,20,0),<BR>Lbl5 =3D create(LText,"Category 3",Win,20,17= 0,60,20,0),<BR>Lbl6 =3D create(LText,"Rank",Win,20,200,60,20,0),<BR><BR>T_C= ode =3D "Code",<BR>T_Desc =3D "Description",<BR>T_Cat =3D "Category",<BR>T_= Rank =3D "Rank"<BR><BR>sequence Diag<BR>Diag =3D repeat(0,6)<BR>Diag[1] = =3D create(EditText,{"",T_Code},Win,100,50,42,20,ES_UPPERCASE)<BR>Diag[2] = =3D create(EditText,{"",T_Desc},Win,100,80,278,20,ES_UPPERCASE)<BR>Diag[3] = =3D create(EditText,{"",T_Cat},Win,100,110,148,20,ES_UPPERCASE)<BR>Diag[4] = =3D create(EditText,{"",T_Cat},Win,100,140,148,20,ES_UPPERCASE)<BR>Diag[5] = =3D create(EditText,{"",T_Cat},Win,100,170,148,20,ES_UPPERCASE)<BR>Diag[6] = =3D create(EditText,{"",T_Rank},Win,100,200,20,20,ES_UPPERCASE)<BR><BR>setW= indowBackColor(Win,rgb(155,255,255))<BR><BR>procedure Diag_onKeyDown( integ= er self, integer event, sequence params )<BR>-- example of how the up and d= own keys can move between EditText boxes<BR>integer pos<BR>if params[1] = =3D VK_DOWN then<BR>pos =3D find(self, Diag)<BR>if pos =3D length(Diag) the= n<BR>pos =3D 1<BR>elsif pos > 0 then<BR>pos +=3D 1<BR>else<BR>return -- = error<BR>end if<BR>setFocus( Diag[pos] )<BR>elsif params[1] =3D VK_UP then<= BR>pos =3D find(self, Diag)<BR>if pos =3D 1 then<BR>pos =3D length(Diag)<BR= >elsif pos > 1 then<BR>pos -=3D 1<BR>else<BR>return -- error<BR>end if<B= R>setFocus( Diag[pos] )<BR>end if<BR>end procedure<BR>setHandler( Diag, w32= HKeyDown, routine_id("Diag_onKeyDown") )<BR><BR>WinMain( Win, Normal )<BR>-= - end code --<BR><BR>~Greg<BR></DIV> <DIV>Thanks for replying Greg. I have already fixed it by chang= ing from the old onXXX method to the sethandler method. I am changing= the routine to look for the page up and page down keys to get next and pre= vious records and I will incorporate your code so that the operator can nav= igate up and down through Diag[1] to Diag[6].<BR>--^-----------------------= -----------------------------------------<BR>This email was sent to: <A hre= f=3D"mailto:ronaustin at alltel.net">ronaustin at alltel.net</A><BR><BR>EASY UNSU= BSCRIBE click here: <A href=3D"http://topica.com/u/?b1dd66.b6KEgr.cm9uYXVz"= >http://topica.com/u/?b1dd66.b6KEgr.cm9uYXVz</A><BR>Or send an email to: <A= href=3D"mailto:EUforum-unsubscribe at topica.com">EUforum-unsubscribe at topica.= com</A><BR><BR>TOPICA - Start your own email discussion group. FREE!<BR><A = href=3D"http://www.topica.com/partner/tag02/create/index2.html">http://www.= topica.com/partner/tag02/create/index2.html</A><BR>--^---------------------= -------------------------------------------<BR><BR><BR><BR><BR>. </DIV></TD= ></TR> <TR> <TD id=3DINCREDIFOOTER width=3D"100%"> <TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%"> <TBODY> <TR> <TD width=3D"100%"></TD> <TD id=3DINCREDISOUND vAlign=3Dbottom align=3Dmiddle></TD> <TD id=3DINCREDIANIM vAlign=3Dbottom align=3Dmiddle></TD></TR></TBODY></TAB= --------------Boundary-00=3D_SBJX6LZ712S000000000--
8. Re: Can't trap the down arrow key
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Nov 26, 2003
- 395 views
----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Subject: RE: Can't trap the down arrow key [snip] > > > > I suspect that all you have to do is ... > > > > setHandler(Screen, w32HKeyDown, routine_id("my down key routine name")) > > > > And inside that handler code, you may have to check that whatever > > control actually has focus, does not 'need' the arrow down/up key for > > its own purposes - eg. a MleText or List field. > > > > Why will this work? Because the Screen control is used to trap events > <snip> > > vars = fld1&fl2&fld3 ...... > > setHandler(vars, w32HKeyDown, routine_id("keydown")) > > > some of my screens may have a dozen fields or so I changed it a bit so I > could use it in a loop and it works great! > sequence fields > > fields = repeat(6,0) > for i = 1 to 6 do > fields = fields & Diag[i] > end for > > setHandler(fields, w32HKeyDown, routine_id("keydown")) > I guess I didn't explain it enough. If you use the Screen control ID you won't have to do ... fields = repeat(6,0) for i = 1 to 6 do fields = fields & Diag[i] end for stuff at all. And your code ONLY works if one of the controls in Diag have focus. If another control has focus when you press the down arrow, nothing will happen. And besides, the code example you gave could be better written as ... fields = repeat(6,0) for i = 1 to 6 do fields[i] = Diag[i] end for which begs the question, why bother with the 'fields' varaible at all. Just do... setHandler(Diag, w32HKeyDown, routine_id("keydown")) But I still recommend setHandler(Screen, w32HKeyDown, routine_id("keydown")) because it doesn't matter which field on which window has focus then. Your "keydown" handler will always get invoked. -- Derek
9. Re: Can't trap the down arrow key
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Nov 26, 2003
- 411 views
----- Original Message ----- >From: "Ron Austin" <ronaustin at alltel.net> >To: <EUforum at topica.com> >Subject: Re: Can't trap the down arrow key I see you are using Incredmail email client. I can tell because I can't read your email. It is presented by Outlook Express as a blank email. -- Derek
10. Re: Can't trap the down arrow key
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 26, 2003
- 403 views
<snip> >> fields = repeat(6,0) >> for i = 1 to 6 do >> fields = fields & Diag[i] >> end for <snip> > > fields = repeat(6,0) > for i = 1 to 6 do > fields = fields & Diag[i] > end for > >And besides, the code example you gave could be better written as ... > > fields = repeat(6,0) > for i = 1 to 6 do > fields[i] = Diag[i] > end for > I have to say _something_ Firstly, fields=repeat(6,0) gives fields={}. I suspect the original intent was fields=repeat(0,6). Secondly, the for loop is mighty long-winded. You can just replace the whole lot with: fields=Diag or possibly fields=Diag[1..6] ..and as Derek said: >which begs the question, why bother with the 'fields' varaible at all. Regards, Pete http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html
11. Re: Can't trap the down arrow key
- Posted by "Kat" <gertie at visionsix.com> Nov 26, 2003
- 405 views
On 26 Nov 2003, at 18:53, Derek Parnell wrote: > > > ----- Original Message ----- > >From: "Ron Austin" <ronaustin at alltel.net> > >To: <EUforum at topica.com> > >Sent: Wednesday, November 26, 2003 9:47 AM > >Subject: Re: Can't trap the down arrow key > > I see you are using Incredmail email client. I can tell because I can't read > your email. It is presented by Outlook Express as a blank email. It's blank in Pegasus also. Kat