Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Windows version of INKEY$?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Windows version of INKEY$?
#1079
Posted by: Lawrence 2003-08-18 22:53:13
Ok... I'm looking for a way so that a program runs a subroutine whenever you hit the Enter key... In DOS I can do that (well, letters anyways) with INKEY$, but I'm not sure how to do that with windows...
Message2. Re: Windows version of INKEY$?
#1080
Posted by: guidance 2003-08-19 06:19:55
Try form.onkeydown:
http://g.yi.org/_scripts/file.php?f=516&r=2330
Message3. Re: Windows version of INKEY$?
#1081
Posted by: Lawrence 2003-08-20 12:33:22
Ok... Thanks for that link, but when I tried it, it didn't work for me...
I'll put my test code here... and hope you can help...

 DECLARE SUB Test(Key AS WORD)

 CREATE Form AS QFORM
  CAPTION = "Form1"
  Width = 320
  Height = 240
  Center
  CREATE Button1 AS QBUTTON
   CAPTION = "Button1"
   Left = 86
   Top = 21
  END CREATE
 END CREATE

 Form.OnKeyPress = Test
 Form.SHOWMODAL

 SUB Test(Key AS WORD)
  Button1.CAPTION = Key
 END SUB

Message4. Re: Windows version of INKEY$?
#1082
Posted by: guidance 2003-08-20 18:38:53
button1.caption cannot be a Word, try str$(key) or simply "? key" for debug.
Message5. Re: Windows version of INKEY$?
#1083
Posted by: Lawrence 2003-08-20 23:01:36
There we go... It works as QLabel, but doesn't work when I use QButton... duno (this is after I added STR$())

I guess the problem with that is it can't work when anything else is selected...
But what can I do about that? make things unselectable or is there something that unselects anything.?



Post Edited (08-20-03 23:12)
Message6. Re: Windows version of INKEY$?
#1084
Posted by: guidance 2003-08-21 07:31:53
QButton also has onkeypress and onkeydown event, you can let it call the same handler sub.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0