Textbox and Cursor Position

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

franco
Posts: 213
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Re: Textbox and Cursor Position

Post by franco » Sun Jun 18, 2017 4:26 pm

Nice work All,
Can anyone tell me how to use the clipper keyboard() command in HMG, This could solve a lot of our problems.
Franco

KDJ
Posts: 182
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland
Been thanked: 200 times

Post by KDJ » Sun Jun 18, 2017 7:02 pm

Franco

Functions:
_PushKey and HMG_PressKey (surces in h_hotkey.prg),
Keybd_Event (surce in c_controlmisc.c),
HMG_SendCharacter (surce in c_EventCB.c),
and other.

Read HMG documentation -> Advanced -> Read Keyboard and Mouse.

franco
Posts: 213
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Post by franco » Sun Jun 18, 2017 8:09 pm

Thanks KDJ,
I will try all of these
Franco ;)

Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF
Has thanked: 10 times
Been thanked: 2 times

Post by Karl » Mon Jun 19, 2017 7:30 am

KDJ wrote:
Sun Jun 18, 2017 7:02 pm
Read HMG documentation -> Advanced -> Read Keyboard and Mouse.
Thanks Krysztof, Franco
I´ll try too.
Karl
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit

Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF
Has thanked: 10 times
Been thanked: 2 times

Post by Karl » Mon Jun 19, 2017 7:39 pm

Hi all,
seems I found the right way and it works perfect. For a beginner it´s a very big chapter to learn "Create Events".
Karl

Code: Select all

//Testprogram Mouseclick in Textbox

#include "hmg.ch"

PROCEDURE main()

DEFINE WINDOW form_1 ;
	  AT 0,0 ;
	  WIDTH 600 ;
	  HEIGHT 230 ;
	  FONT 'Arial' SIZE 9 ;
	  TITLE '   Test Program for TextBoxes' ;
          MAIN
	
@  60,20  LABEL label_1 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 300 ;
          VALUE "Textbox-1 (3 x alpha-Char. and Upper)" ;
          FONT 'Arial' SIZE 12
          
@  60,370 TEXTBOX text_1 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 60 ;
          VALUE '' ;
          FONT 'Arial' SIZE 12;
          INPUTMASK 'AAA' ;
	  ON CHANGE {||THIS.VALUE := HMG_UPPER(THIS.VALUE)} ;
          ON GOTFOCUS {||IF(THIS.VALUE = " ", EventStop(EvInd_1, .F.), EventStop(EvInd_1, .T.))}
	
@  90,20  LABEL label_2 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 300 ;
          VALUE "Textbox-2 (4 x numeric-Characters)" ;
          FONT 'Arial' SIZE 12

@  90,370 TEXTBOX text_2 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 60 ;
          VALUE '' ;
          FONT 'Arial' SIZE 12 ;
          INPUTMASK '9999' ;
          ON GOTFOCUS {||IF(THIS.VALUE = " ", EventStop(EvInd_2, .F.), EventStop(EvInd_2, .T.))}
          
@ 120,20  LABEL label_3 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 350 ;
          VALUE "Textbox-3 (17 x alphanumeric Char. and Upper)" ;
          FONT 'Arial' SIZE 12
          
@ 120,370 TEXTBOX text_3 OF form_1 ;
          HEIGHT 20 ;
          WIDTH 200 ;
          VALUE '' ;
          FONT 'Arial' SIZE 12 ;
          INPUTMASK '!!!!!!!!!!!!!!!!!' ;
          ON GOTFOCUS {||IF(THIS.VALUE = " ", EventStop(EvInd_3, .F.), EventStop(EvInd_3, .T.))}
	
END WINDOW

EvInd_1 := EventCreate("Edit_LBUTTONUP", form_1.text_1.HANDLE, 514)
EvInd_2 := EventCreate("Edit_LBUTTONUP", form_1.text_2.HANDLE, 514)
EvInd_3 := EventCreate("Edit_LBUTTONUP", form_1.text_3.HANDLE, 514)

CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
RETURN Nil

FUNCTION Edit_LBUTTONUP()
  HMG_EditControlSetSel(EventHWND(), 0, 0)
RETURN NIL
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit

Post Reply