1. Markus Schröder
  2. PowerBuilder
  3. Friday, 31 March 2023 06:03 AM UTC

There are situations where I want to prevent the user from switching between sheet windows via Ctrl-Tab.
I have tried the following in the datawindow pbm_dwnkey event (without success):

  blob{64} lblb_Msg
  PeekMessage(lblb_Msg, 0, 256, 264, 1 ) //WM_KEYFIRST = 0x0100 256  WM_KEYLAST  = 0x0108 264  PM_REMOVE = 1
  message.processed = TRUE                
  message.returnvalue = 1           
  Return 1

Is there another way to do this?

Accepted Answer
Markus Schröder Accepted Answer Pending Moderation
  1. Friday, 31 March 2023 09:27 AM UTC
  2. PowerBuilder
  3. # Permalink

I have found a solution: In situations where I want to prevent the user from switching between sheet windows via Ctrl-Tab, I open a (non-sheet) invisible popup window. This way, Ctrl-Tab doesn't cause a window switch in my sheet windows.

Note: This is necessary during an asynchronous retrieve, where only the Escape key is allowed to abort the retrieve.

Comment
  1. Markus Schröder
  2. Friday, 31 March 2023 12:17 PM UTC
Hi Chris,

i first considered this solution, but could not assign the ctrl-tab shortcut in the menu. How did you do that.
  1. Helpful
  1. Roland Smith
  2. Friday, 31 March 2023 12:29 PM UTC
Tab isn't in the keys drop-down. Chris was likely using a different key. I use the hidden shortcut key method for printing. CTRL-P is assigned to a hidden menu item that sends the report directly to the printer. The visible print menu item opens the print options window.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 31 March 2023 13:57 PM UTC
Hi Guys;

Yes, the TAB assignment is not there in the Menu painter - so you need to edit the menu source directly and provide the shortcut property's numeric value directly in the source code. I can't remember the exact number offhand for this combination but, I do have the following code example ...

int sh

sh = m.item.ShortCut

if sh > 0 then

ls_sh = "~t"

if sh >= 1024 then

ls_sh += "Shift+"

sh -= 1024

end if

if sh >= 512 then

ls_sh += "Alt+"

sh -= 512

end if

if sh >= 256 then

ls_sh += "Ctrl+"

sh -= 256

end if



So since the numeric value for CTRL is 256, you just need to add the numeric value for a TAB character (ASCII keyboard wise). If I recall correctly though, a TAB is a keyboard numeric #9. So a CTRL+TAB should be 256 + 9 = 265 for the menu item shortcut property value. HTH

Regards ... Chris
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 31 March 2023 06:53 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

I think the problem is that certain key(combinatoins) are being reserved by windows for windows.

You can remap or maybe even unmap them, but of course that would affect any other application too.

https://www.howtogeek.com/710290/how-to-remap-any-key-or-shortcut-on-windows-10/

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.