bKeydown Dialog

Post Reply
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

bKeydown Dialog

Post by ask »

See the bellow example.
Type a number inside the textbox and press f2.The odlg:bkeydown is fired by I don't get the value of nFld item.I have to press f2 twice to see the value .Is there a solution for that?



Example:

#include "fivewin.ch"


function main()
local oDlg,nFld:=0

define dialog oDlg ;
from 10,10 to 100,200 pixel

@ 0,0 get nFld size 50,14 pixel of oDlg

oDlg:bkeydown:={|nKey,nFlag|if (nKey==113,msginfo(nFld),nil)}

activate dialog oDlg

return ""
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Re: bKeydown Dialog

Post by ask »

ask wrote:See the bellow example.
Type a number inside the textbox and press f2.The odlg:bkeydown is fired by I don't get the value of nFld item.I have to press f2 twice to see the value .Is there a solution for that?



Example:

#include "fivewin.ch"


function main()
local oDlg,nFld:=0

define dialog oDlg ;
from 10,10 to 100,200 pixel

@ 0,0 get nFld size 50,14 pixel of oDlg

oDlg:bkeydown:={|nKey,nFlag|if (nKey==113,msginfo(nFld),nil)}

activate dialog oDlg

return ""

As i can see you can change the above to:

#include "fivewin.ch"


function main()
local oDlg,nFld:=0,oFld

define dialog oDlg ;
from 10,10 to 100,200 pixel

@ 0,0 get oFld var nFld size 50,14 pixel of oDlg

oDlg:bkeydown:={|nKey,nFlag|if (nKey==113,(oFld:oGet:Assign(),msginfo(nFld)),nil)}

activate dialog oDlg

return ""


But i don't thing that it's the best solution
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Ask,

The GET does not update its value until it looses focus or you assign it, as you are doing in your code.
regards, saludos

Antonio Linares
www.fivetechsoft.com
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Post by ask »

Antonio Linares wrote:Ask,

The GET does not update its value until it looses focus or you assign it, as you are doing in your code.
OK. Thanks Antonio
Post Reply