BACKTAB in Grid with editmode (SOLVED!)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

BACKTAB in Grid with editmode (SOLVED!)

Post by zolysoftsolutions » Wed Apr 17, 2019 5:36 am

Hi all.

I'am trying to use a grid to introduce some data.
In main procedure SET NAVIGATION EXTENDED - is set on
The grid have AllowEdit:=T and Cellnavigation:=.F.
Everything is working normal, when I introduce a value in a cell, on enter the cursor moves to next cell and edit it. That's very nice.
BUT, WHAT if the user made a mistake and want to move back to the previous cell??? Pressing the Back arrow or shift-tab NOTHING HAPPENS. Is very very frustrating to Press escape and on the Enter key the cursor start editing the row starting with the FIRST cell?
Is a shorter, simplier, more normal way to edit the previous cell in this context?
proba.zip
(1.37 KiB) Downloaded 26 times
Thank you much,
Zoli B.
Last edited by zolysoftsolutions on Wed Apr 17, 2019 2:52 pm, edited 2 times in total.
_______________________________
Open eyes for you!

User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

Post by zolysoftsolutions » Wed Apr 17, 2019 9:24 am

So, in EDIT mode of the grid we have no solution, just press ENTER (move focus forward) or ESC (leave edit mode)?
Is a way in HMG to edit an array into a grid where exists the posibility to set focus to previous cell without mouse or several keypress?
I don't believe that nobody made a simple invoicing application with this issue :)
_______________________________
Open eyes for you!

User avatar
gfilatov
Posts: 636
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 23 times
Been thanked: 208 times
Contact:

Post by gfilatov » Wed Apr 17, 2019 10:05 am

zolysoftsolutions wrote:
Wed Apr 17, 2019 9:24 am
So, in EDIT mode of the grid we have no solution, just press ENTER (move focus forward) or ESC (leave edit mode)?
Is a way in HMG to edit an array into a grid where exists the posibility to set focus to previous cell without mouse or several keypress?
I don't believe that nobody made a simple invoicing application with this issue :)
Hi,

Thanks for your interest!

Please note that GRID control offers a basic functionality.

You may take a look for a power TSBrowse implementation at
http://hmgforum.com/viewtopic.php?f=8&t=1492

It provides a post-edition cursor movement. Cursor goes to next editable cell, right or first-down according to the position of the last edited cell.
// Cursor movement after editing
#define DT_DONT_MOVE 0
#define DT_MOVE_RIGHT 1
#define DT_MOVE_DOWN 2
#define DT_MOVE_LEFT 3
#define DT_MOVE_UP 4
#define DT_MOVE_NEXT 5
Hope that useful :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

Post by zolysoftsolutions » Wed Apr 17, 2019 10:10 am

Thank you very much Grigory.
I start to study right now.
I hope it works with arrays, because I store my data in MySql databases, not simple DBF-s.

Zoli B.
_______________________________
Open eyes for you!

User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

Post by zolysoftsolutions » Wed Apr 17, 2019 11:02 am

Hi Gregory,
I am using HMG 3.4.4...and I cannot find a way to install TSBrowse.
_______________________________
Open eyes for you!

User avatar
gfilatov
Posts: 636
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 23 times
Been thanked: 208 times
Contact:

Post by gfilatov » Wed Apr 17, 2019 12:35 pm

zolysoftsolutions wrote:
Wed Apr 17, 2019 11:02 am
I cannot find a way to install TSBrowse.
Hi again,

It is expected because the above TSBrowse is very old version 7.0 :oops:

The current MiniGUI Ext build uses the updated and improved TSBrowse library version 9.0 :!:

Your feedback is welcome anyway.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

Post by zolysoftsolutions » Wed Apr 17, 2019 12:44 pm

Thanks a lot Gregory.. I think one day I will migrate to minigui ext.
I hope to find at the moment a solution in HMG 3.4.4 by a columnwhen or columnvalid or by some keypress event procedure.
I saw that exist INPLACEEDITEVENT of the grid control..BUT is strange and almost useless .. I can know everything happens inside the edited field, BUT I CANNOT terminate the edit process :)
_______________________________
Open eyes for you!

edk
Posts: 450
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 134 times
Been thanked: 370 times

Post by edk » Wed Apr 17, 2019 2:31 pm

Try this sample (should works with Shift+Tab keys)

Code: Select all

#include "hmg.ch"

Function Main

Local aRows [20] [3]

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 800 ;
		HEIGHT 550 ;
		TITLE 'Hello World!' ;
		MAIN 

		aRows [1]	:= {'Simpson','Homer','555-5555'}
		aRows [2]	:= {'Mulder','Fox','324-6432'} 
		aRows [3]	:= {'Smart','Max','432-5892'} 
		aRows [4]	:= {'Grillo','Pepe','894-2332'} 
		aRows [5]	:= {'Kirk','James','346-9873'} 
		aRows [6]	:= {'Barriga','Carlos','394-9654'} 
		aRows [7]	:= {'Flanders','Ned','435-3211'} 
		aRows [8]	:= {'Smith','John','123-1234'} 
		aRows [9]	:= {'Pedemonti','Flavio','000-0000'} 
		aRows [10]	:= {'Gomez','Juan','583-4832'} 
		aRows [11]	:= {'Fernandez','Raul','321-4332'} 
		aRows [12]	:= {'Borges','Javier','326-9430'} 
		aRows [13]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [14]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [15]	:= {'Batistuta','Gol','485-2843'} 
		aRows [16]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [17]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [18]	:= {'Samarbide','Armando','854-7873'} 
		aRows [19]	:= {'Pradon','Alejandra','???-????'} 
		aRows [20]	:= {'Reyes','Monica','432-5836'} 

		@ 5,10 GRID Grid_1 ;
			WIDTH 760 ;
			HEIGHT 500 ;
			HEADERS {'Last Name','First Name','Phone'} ;
			WIDTHS {140,140,140};
			ITEMS aRows ;
			VALUE 1 ;
			EDIT ;
			TOOLTIP 'Editable Grid Control' ;
			ON HEADCLICK { {||MsgInfo('Click 1')} , {||MsgInfo('Click 2')} , {||MsgInfo('Click 3')} } ;
               JUSTIFY { GRID_JTFY_LEFT,GRID_JTFY_CENTER, GRID_JTFY_CENTER };
               ON INPLACEEDITEVENT ProcGridInplaceEditEvent()
                	
	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return


****************************************************
FUNCTION ProcGridInplaceEditEvent()

DO CASE

	CASE This.IsInplaceEditEventInit == .T.
      
	CASE This.IsInplaceEditEventRun == .T.

		IF GetKeyState ( VK_SHIFT ) < 0 .AND. GetKeyState ( VK_TAB ) < 0		//SHIFT+TAB
			DO WHILE GetKeyState ( VK_SHIFT ) < 0 .OR. GetKeyState ( VK_TAB ) < 0		//Wait for release SHIFT and TAB keys
				DO EVENTS
			ENDDO
			_HMG_SYSDATA [ 340 ] := _HMG_SYSDATA [ 340 ] - 2
			IF  _HMG_SYSDATA [ 340 ] < 0
				_HMG_SYSDATA [ 340 ] := 0
			ENDIF
			_PushKey (VK_RETURN)
		ENDIF

	CASE This.IsInplaceEditEventFinish == .T.

	ENDCASE

RETURN NIL

Last edited by edk on Wed Apr 17, 2019 4:40 pm, edited 1 time in total.

User avatar
zolysoftsolutions
Posts: 121
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Has thanked: 1 time
Contact:

Post by zolysoftsolutions » Wed Apr 17, 2019 2:51 pm

EDK ! You saved my life.. :)
Thank you so much! Is perfectly working..

Best regards,
Zoli B.
_______________________________
Open eyes for you!

User avatar
mol
Posts: 3185
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 211 times
Been thanked: 112 times
Contact:

Post by mol » Wed Apr 17, 2019 7:51 pm

Your solutions are wonderful every time, Edward!
Thanks!

Post Reply