Re: Can't trap the down arrow key

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

--------------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>&nbsp;</DIV>
<DIV id=3DIncrediOriginalMessage><I>-------Original Message-------</I></DIV=
>
<DIV>&nbsp;</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>&nbsp;</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 &gt; 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 &gt; 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.&nbsp; I&nbsp; have already fixed it by chang=
ing from the old onXXX method to the sethandler method.&nbsp; 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--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu