Page 1 of 1

BACKTAB in Grid with editmode (SOLVED!)

Posted: Wed Apr 17, 2019 5:36 am
by zolysoftsolutions
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 172 times
Thank you much,
Zoli B.

Re: BACKTAB in Grid with editmode

Posted: Wed Apr 17, 2019 9:24 am
by zolysoftsolutions
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 :)

Re: BACKTAB in Grid with editmode

Posted: Wed Apr 17, 2019 10:05 am
by gfilatov
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:

Re: BACKTAB in Grid with editmode

Posted: Wed Apr 17, 2019 10:10 am
by zolysoftsolutions
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.

Re: BACKTAB in Grid with editmode

Posted: Wed Apr 17, 2019 11:02 am
by zolysoftsolutions
Hi Gregory,
I am using HMG 3.4.4...and I cannot find a way to install TSBrowse.

Re: BACKTAB in Grid with editmode

Posted: Wed Apr 17, 2019 12:35 pm
by gfilatov
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.

Re: BACKTAB in Grid with editmode (not solved)

Posted: Wed Apr 17, 2019 12:44 pm
by zolysoftsolutions
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 :)

Re: BACKTAB in Grid with editmode (not solved)

Posted: Wed Apr 17, 2019 2:31 pm
by edk
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


Re: BACKTAB in Grid with editmode (not solved)

Posted: Wed Apr 17, 2019 2:51 pm
by zolysoftsolutions
EDK ! You saved my life.. :)
Thank you so much! Is perfectly working..

Best regards,
Zoli B.

Re: BACKTAB in Grid with editmode (SOLVED!)

Posted: Wed Apr 17, 2019 7:51 pm
by mol
Your solutions are wonderful every time, Edward!
Thanks!