Set Navigation Extended - Spinner, CheckBox and Button

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Set Navigation Extended - Spinner, CheckBox and Button

Post by Rathinagiri »

'Set Navigation Extended' is a nice feature to imitate tab key by pressing enter key allowing the user to press enter key to move through the controls in a window.

This feature is not available to spinner, checkbox and button so far. I have tried to create an event (thanks to Claudio) to solve this.

Please run this sample:

Code: Select all

#include <hmg.ch>

Function Main

   set navigation extended

   define window main at 0, 0 width 400 height 300 main
      define textbox t1
         row 10
         col 10
         width 100
      end textbox
      define spinner s1
         row 40
         col 10
         width 100
         rangemin 1
         rangemax 100
         value 1
      end spinner
      define checkbox c1
         row 70
         col 10
         caption 'Sample'
      end checkbox         
      define button click
         row 100
         col 10
         caption 'Click'
         action msginfo( 'Just a test' )
      end button   
   end window
   create event procname ImitateEnterKey() HWND GetControlHandle( 's1', 'main' )[ 1 ] // getcontrolhandle of spinner returns an array of two handles one for textbox and another for up/down button.
   create event procname ImitateEnterKey() HWND GetControlHandle( 'c1', 'main' )
   create event procname ImitateEnterKey() HWND GetControlHandle( 'click', 'main' )
  Main.Center
  Main.Activate
Return

function ImitateEnterKey()
   local nVKDown := HMG_GetLastVirtualKeyDown()
   if nVKDown ==  VK_RETURN
      HMG_CleanLastVirtualKeyDown()
      _Pushkey(VK_TAB)
   endif
return nil


This way you can navigate by pressing enter key to all the controls.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Set Navigation Extended - Spinner, CheckBox and Button

Post by Javier Tovar »

Gracias Sr. Rathinagiri por su apoyo y constancia a HMG.

Saludos

////////////////////////////////////////////////////////////////////////
Thanks for your support Mr. Rathinagiri and perseverance HMG.

greetings
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Set Navigation Extended - Spinner, CheckBox and Button

Post by esgici »

Thanks Mr. Rathinagiri :)

Good idea, nice work ( as always ) :)

Definitely, I need more work on this nice feature: events ;)

TIA
Viva INTERNATIONAL HMG :D
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Set Navigation Extended - Spinner, CheckBox and Button

Post by bpd2000 »

+1
BPD
Convert Dream into Reality through HMG
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Set Navigation Extended - Spinner, CheckBox and Button

Post by Pablo César »

Thanks Rathinagiri for sharing.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply