inkey(0)

inkey(0)

Postby Natter » Sun Aug 25, 2024 6:12 am

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 view  RUN
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 ?
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: inkey(0)

Postby Antonio Linares » Sun Aug 25, 2024 9:02 am

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: inkey(0)

Postby Natter » Sun Aug 25, 2024 12:21 pm

Thank you, Antonio! I figured it out.
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: inkey(0)

Postby karinha » Sun Aug 25, 2024 5:11 pm

Use:

Code: Select all  Expand view  RUN

   IF LASTKEY() = VK_ESCAPE

      ...

   ELSE

      ...

   ENDIF
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7832
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 40 guests

cron