Textbox and Cursor Position

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Textbox and Cursor Position

Post by franco »

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
All The Best,
Franco
Canada
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: Textbox and Cursor Position

Post by KDJ »

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: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Textbox and Cursor Position

Post by franco »

Thanks KDJ,
I will try all of these
Franco ;)
All The Best,
Franco
Canada
Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF

Re: Textbox and Cursor Position

Post by Karl »

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

Re: Textbox and Cursor Position

Post by Karl »

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