Recent

Author Topic: Shift+Num7 must give Shift+Home, but gives only Home  (Read 2663 times)

Alextp

  • Hero Member
  • *****
  • Posts: 888
    • UVviewsoft
Shift+Num7 must give Shift+Home, but gives only Home
« on: November 20, 2018, 06:17:05 pm »
I have test app which shows the gtk2 issue.
It shows pressed key in form caption

Code: Pascal  [Select]
  1. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  2. var
  3.   sh: TShortCut;
  4. begin
  5.   sh:= ShortCut(key, shift);
  6.   caption:= ShortCutToText(sh);
  7. end;
  8.  

Now user cannot press Shift+Home via his number block on notebook. (and 2nd keyboard too.)  He always gets Home instead of Shift+Home. He pressed Shift+Num7.

Code: Pascal  [Select]
  1. [~/Dev/CudaText_up]$ xev | grep keycode    
  2.     state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
  3.     state 0x11, keycode 79 (keysym 0xff95, KP_Home), same_screen YES,
  4.     state 0x11, keycode 79 (keysym 0xff95, KP_Home), same_screen YES,
  5.     state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
  6.     state 0x10, keycode 65 (keysym 0x20, space), same_screen YES,
  7.     state 0x10, keycode 65 (keysym 0x20, space), same_screen YES,
  8.     state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
  9.     state 0x11, keycode 110 (keysym 0xff50, Home), same_screen YES,
  10.     state 0x11, keycode 110 (keysym 0xff50, Home), same_screen YES,
  11.     state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,

first 4 lines - he pressed Shift+Num7
next 2 lines -  spaces
next 4 lines - he presses Shift+<usual Home on 2nd keyboard>

(NumLock don't help, Home becomes 7)


lucamar

  • Hero Member
  • *****
  • Posts: 2081
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #1 on: November 20, 2018, 06:53:40 pm »
That's the expected behaviour. The (Numpad) "7"  key will give "7" when unshifted and "Home" when shifted or viceversa, depending on the state of CapsLock. Idem with "1", "9" and "3" with "End", "PgUp" and "PgDn"

Although you're right in that OnKeyDown should pass Key=VK_Numpad7 and Shift = [ssShift].
« Last Edit: November 20, 2018, 06:57:22 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #2 on: November 20, 2018, 07:12:09 pm »
@ That's the expected behaviour.

No, it's Delphi incompatible.

Delphi 7:
Num Lock On:
Num7 (~103) / Shift+Home

Num Lock Off:
Home / Shift+Home

Lazarus + Qt4:
Num Lock On:
7 (~55) / Shift+Home

Num Lock Off:
Home / Shift+7 (~55)

EDIT: should be reported, incompatibility Delphi - Laz., and also GTk2-Qt4. BTW, you need LCLProc and Menus units to test Alextp's code.
« Last Edit: November 20, 2018, 07:19:29 pm by Blaazen »
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Alextp

  • Hero Member
  • *****
  • Posts: 888
    • UVviewsoft
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #3 on: November 20, 2018, 07:21:32 pm »
User tells: in all other apps, he can do Shift+Home (using Num7 key); but he cannot in CudaText, CudaText only goes to line start (other apps do selection to line start)

Alextp

  • Hero Member
  • *****
  • Posts: 888
    • UVviewsoft
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #4 on: November 20, 2018, 07:32:32 pm »
Reported to https://bugs.freepascal.org/view.php?id=34576
pls comment there about Delphi7.

lucamar

  • Hero Member
  • *****
  • Posts: 2081
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #5 on: November 20, 2018, 07:56:38 pm »
@ That's the expected behaviour.

No, it's Delphi incompatible.

I meant the expected behaviour referred to how the keyboard works. I must confess that I've never tried this in code (one tends to assume there's a handy "Home" key somewhere :-[)  so I don't really know how Delphi (or FPC) copes with it. Some quick tests in this laptop--Dell D620--show some queerness but that may as well be because the keyboard itself is somewhat "queer"--at least compared to a normal desktop one.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5699
    • wiki
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #6 on: November 20, 2018, 08:09:01 pm »
Just tested, in gedit "num7" acting as "home" (numlock off) can not be used with shift to get shift-home. It will instead insert "7" into the text. With numlock, it is always "7".
Fedora 28

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #7 on: November 20, 2018, 08:10:41 pm »
My tests was also with laptop keyboard. Yes, it's better to have real Home/End keys.
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #8 on: November 20, 2018, 08:15:21 pm »
So I tested Kate:
NumLock Off: Home / Shift+Home
NumLock On: 7 / Home

It seems there are no two widgetsets and applicarions with the same behaviour. :)
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #9 on: November 22, 2018, 02:56:58 pm »
Does Qt/Qt5 works same as Kate ?

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #10 on: November 22, 2018, 05:06:09 pm »
No.

Lazarus + Qt4 or Qt5 (same):
Num Lock Off: Home / Shift+7 (~55)
Num Lock On: 7 (~55) / Shift+Home

Kate:
NumLock Off: Home / Shift+Home
NumLock On: 7 / Home
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Shift+Num7 must give Shift+Home, but gives only Home
« Reply #11 on: November 22, 2018, 07:57:13 pm »
So ws implementation is probably wrong