Author Topic: ALT+Enter  (Read 107 times)

Offline krovit

  • Newbie
  • Posts: 69
ALT+Enter
« on: February 14, 2020, 04:30:15 AM »
Hi,

I can't handle ALT-Left + Enter  and ALT-Right + Enter

All ok for CTRL (Left and Right) + Enter but no for ALT.
Obviously using _KEYIT, INKEY$, _KEYDOWN...

Tips?



« Last Edit: February 14, 2020, 04:33:29 AM by krovit »

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 1890
  • LET IT = BE
    • QB64.org
Re: ALT+Enter
« Reply #1 on: February 14, 2020, 05:51:37 AM »
Alt+ENTER is used internally to switch to full screen. To disable the combo so you can trap it, use:
Code: QB64: [Select]

For example:

Code: QB64: [Select]
  1.  
  2. ALLOWFULLSCREEN OFF
  3.     k& = KEYHIT
  4.  
  5.     'waiting for alt+enter
  6.     IF KEYDOWN(100308) AND k& = 13 THEN
  7.         i& = i& + 1
  8.         PRINT "Left Alt+ENTER was pressed"; i&; "times."
  9.     END IF
  10.  
  11.     IF KEYDOWN(100307) AND k& = 13 THEN
  12.         j& = j& + 1
  13.         PRINT "Right Alt+ENTER was pressed"; j&; "times."
  14.     END IF
  15.  
  16.     LIMIT 30
  17.     DISPLAY
« Last Edit: February 14, 2020, 05:57:54 AM by FellippeHeitor »

Offline krovit

  • Newbie
  • Posts: 69
Re: ALT+Enter
« Reply #2 on: February 14, 2020, 06:23:04 AM »
the sequence of my commands was incorrect!

Perfect, thank-you!