inkey(0)

Post Reply
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

inkey(0)

Post by Natter »

Hi,

I need to perform some actions in an infinite loop, taking into account the pressed key at each iteration. I wrote:

Code: Select all | Expand

do while .T.
  if inkey(0)=32
    .........
  else
    exit
  endif
  sysrefresh()
enddo
However, in FW24.2, this design does not work. That is, inkey(0) freezes. How can this be implemented ?
User avatar
Antonio Linares
Site Admin
Posts: 42513
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Re: inkey(0)

Post by Antonio Linares »

If you are using a Windows GUI app you must be using a window or a dialog and then you check the inkey event on those objects

Are you showing something in your app ?

Please post a complete and reduced example, thank you
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Re: inkey(0)

Post by Natter »

Thank you, Antonio! I figured it out.
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: inkey(0)

Post by karinha »

Use:

Code: Select all | Expand

   IF LASTKEY() = VK_ESCAPE

      ...

   ELSE

      ...

   ENDIF
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Post Reply