Page 1 of 2

GRID - COLUMNCONTROLS

Posted: Sun Feb 08, 2015 10:27 pm
by Pablo César
Hi HDT (HMG Development Team),

Is it posible to add a new property for SPINNERs at GRID when is defined at COLUMNCONTROLS ?
Screen1.png
Screen1.png (41.58 KiB) Viewed 5828 times
For COLUMNCONTROLS:

We use to declare like this: aCtrl_06 := { 'SPINNER', 1, 20 }
The suggested is to accept fourth parameter, like this: aCtrl_06 := { 'SPINNER', 1, 20, 5 }
This is to make INCREMENT at spinning in Grids, it could be important and optional too.

For this propose, shall it be implemented at _HMG_PARSEGRIDCONTROLS function too (around line # 1352).

I would like to receive any return (if yes or not) in order to make facilities at InputWindow(), otherwise this option will be fixed to increment always be +1. :?

Thank you for you attention.

Re: GRID - COLUMNCONTROLS

Posted: Mon Feb 09, 2015 4:34 am
by bpd2000
Pablo César wrote:Hi HDT (HMG Development Team),

Is it posible to add a new property for SPINNERs at GRID when is defined at COLUMNCONTROLS ?
+1

Re: GRID - COLUMNCONTROLS

Posted: Mon Feb 09, 2015 4:37 am
by Javier Tovar
+1

Re: GRID - COLUMNCONTROLS

Posted: Mon Feb 09, 2015 9:02 am
by serge_girard
+1

Re: GRID - COLUMNCONTROLS

Posted: Mon Feb 09, 2015 4:23 pm
by Rathinagiri
Sure, we can do that Pablo.

GRID - COLUMNCONTROLS

Posted: Mon Feb 09, 2015 5:13 pm
by Pablo César
Thank you guys :D

GRID - COLUMNCONTROLS

Posted: Tue Feb 10, 2015 12:25 pm
by Pablo César
Hi HDT (HMG Development Team) again,

Is it posible to add another new property for TEXTBOX at GRID when is defined at COLUMNCONTROLS ?

For COLUMNCONTROLS:

We use to declare like this:
  • aCtrl_07 := { 'TEXTBOX','CHARACTER' }
  • aCtrl_08 := { 'TEXTBOX','DATE' }
  • aCtrl_09 := { 'TEXTBOX','NUMERIC','99999999' }
The suggested is to accept the string "PASSWORD" at second parameter, option as CTYPE normally used to define if is NUMERIC, CHARACTER or DATE, then the TEXTBOX will act as PASSWORD new property:
Screen1.png
Screen1.png (65.73 KiB) Viewed 5688 times
Then we could make like this: aCtrl_10 := { 'TEXTBOX', "PASSWORD" }
This is new implementation will allow to put passwords at specific column of GRID and this is optional too.

For this propose, need to only correct at _HMG_GRIDINPLACEEDIT function in h_grid.prg (around line # 1072).
Screen2.png
Screen2.png (48.6 KiB) Viewed 5688 times
I rebuilded lib and realized a test in C:\hmg.3.4.0\SAMPLES\Controls\Grid\GRID_25\demo.prg, changing textbox:
Screen3.png
Screen3.png (34.99 KiB) Viewed 5688 times
The results was partial, for editing is displaying well as password:
Screen4.png
Screen4.png (10.94 KiB) Viewed 5688 times
But for navigating is not displaying as a password. I'll be need a help from HDT, probably Dr. Claudio could offer a solution. At least could be displayed something like this: <Password> (not showing its value).
Screen5.png
Screen5.png (12.37 KiB) Viewed 5688 times
I attached executable file for your appreciation:
GRID_25.rar
Executable file
(1.12 MiB) Downloaded 344 times
I would like to know if this new property could be applied to HMG library if there is a way for different displaying at Grid
probably using lTrueData ? :roll:

If we got solution for this then I make facilities to InputWindow() in this new type. :D

Thank you for you attention more one time,

GRID - COLUMNCONTROLS

Posted: Tue Feb 10, 2015 11:12 pm
by Pablo César
Hi friends,

Actually EDITBOX for ColumnControl only works for Grid in ROWSOURCE (with database) !! :o

And even not been a grid for ROWSOURCE doesn't accept any value ! :shock:

To HDT: In order to work EDITBOX at any type, is it posible to fix _SetItem and _GetItem at h_controlmisc.prg as follows ?
Screen1.png
Screen1.png (88.37 KiB) Viewed 5630 times
This will allow to use EditBox when is also not RowSource.

Taking this opportunity to ask for more this feature also:

When EditBox at Grid, we could define independent files to be edited.
In the column we could put the file names (with path or not for current folder).
Then the system will make a previous checking, it can be interpreted if this strings are being compose a file name or simple string to be edited.

In the source code proposed, we change following at h_grid.prg:
  • New parameter for _HMG_GRIDINPLACEEDITOK procedure.
    PROCEDURE _HMG_GRIDINPLACEEDITOK( IDX, CI, RI, AEC, ALABELS, CTYPE, CINPUTMASK, CFORMAT, CVA, aReturnValues, cValCell )
  • Replace this code:

    Code: Select all

    	IF _HMG_SYSDATA [ 40 ] [ idx ] [ 9 ] == .F.
    
    		_SetItem ( , , ri , aTemp , idx )
    
    	ENDIF
    For this one:

    Code: Select all

    	IF _HMG_SYSDATA [ 40 ] [ idx ] [ 9 ] == .F.  // Pablo on February, 2015
    	   If AEC == 'EDITBOX'
              If ":" $ cValCell .and. File(cValCell)
                  cTextFile:=cValCell
              ElseIf "\" $ cValCell .and. File(GetCurrentFolder()+cValCell)
                 cTextFile:=GetCurrentFolder()+cValCell
              ElseIf V="<memo>" .or. IsDataGridMemo ( Idx, ci )
                 cTextFile:=GetDataGridCellData ( idx , .t. )
              Else
                 cTextFile:=""
              Endif
    	   If Empty(cTextFile)
    	      _SetItem ( , , ri , aTemp , idx )
    	   Else
    	      hb_MemoWrit(cTextFile,aTemp[ci])
    	   Endif
    	ENDIF
You can use this code to make tests (before and after changing HMG library):

Code: Select all

/*
 * HMG Data-Bound Grid Demo
 * (c) 2010 Roberto Lopez
 *
 * Revised by Pablo César Arrascaeta
 * Added EditBox in static cell and files for edition
 *
*/

#include <hmg.ch>

Function Main()
Local cCurrent_Folder:="\Current.txt"
Local cSub_Folder:=GetCurrentFolder()+"\SubFolder\SubFolder.txt"
Local cOther_Folder:="C:\TEMP_TEST\Other.txt"

CreateFolder(GetCurrentFolder()+"\SubFolder")
CreateFolder("C:\TEMP_TEST")

hb_MemoWrit(cCurrent_Folder,"EDIT TEXT 2")
hb_MemoWrit(cSub_Folder,"EDIT TEXT 3")
hb_MemoWrit(cOther_Folder,"EDIT TEXT 4")

SET CELLNAVIGATIONMODE EXCEL

DEFINE WINDOW SAMPLE at 0, 0 width 420 height 200 title 'Sample Cell Navigation Downwards...' main
    define grid grid_1
       row 10
       col 10
       width 380
       height 150
       widths { 100, 100, 120 }
       headers { 'Sl.No.', 'Name', "Editor" }
       cellnavigation .t.
       columnwhen { {|| .t. }, {|| .t. } }
       columncontrols { { 'TEXTBOX', 'NUMERIC', '999' }, { 'TEXTBOX', 'CHARACTER' }, {"EDITBOX"} }
       allowedit .t.
       items { { 1, 'A', "EDIT TEXT 1" }, { 2, 'B', cCurrent_Folder }, { 3, 'C', cSub_Folder }, { 4, 'D', cOther_Folder }, { 5, 'E', "EDIT TEXT 5" }, { 6, 'F', "EDIT TEXT 6" }, { 7, 'G', "EDIT TEXT 7" }, { 8, 'H', "EDIT TEXT 8" }, { 9, 'I', "EDIT TEXT 9" } }
    end grid         
END WINDOW
SAMPLE.center
SAMPLE.activate
RETURN
This demo is working in static cell and also three different ways to define file name for edition.
Screen3.png
Screen3.png (13.99 KiB) Viewed 5612 times
See that files must be define stating with "\" or "C:\"...
Please remember to remove C:\TEMP_TEST folder and SubFolder where this demo will be executed.

Source file for HMG library is attached:
h_grid.rar
Source file (HMG library)
(17.88 KiB) Downloaded 262 times
Executable file for demo (New features):
demo.rar
Executable file (Builded with 3.4.0 and new h_grid.prg)
(1.12 MiB) Downloaded 302 times
Executable file for demo (Old version, 3.3.1):
demo (Builded with olde versions).rar
Executable file (Builded with 3.3.1)
(1.04 MiB) Downloaded 286 times
Screen2.png
Screen2.png (242.13 KiB) Viewed 5629 times
I hope you enjoy it ! :D

Re: GRID - COLUMNCONTROLS

Posted: Wed Feb 18, 2015 10:01 pm
by srvet_claudio
Pablo César wrote:Hi HDT (HMG Development Team),

Is it posible to add a new property for SPINNERs at GRID when is defined at COLUMNCONTROLS ?
Screen1.png
For COLUMNCONTROLS:

We use to declare like this: aCtrl_06 := { 'SPINNER', 1, 20 }
The suggested is to accept fourth parameter, like this: aCtrl_06 := { 'SPINNER', 1, 20, 5 }
This is to make INCREMENT at spinning in Grids, it could be important and optional too.

For this propose, shall it be implemented at _HMG_PARSEGRIDCONTROLS function too (around line # 1352).

I would like to receive any return (if yes or not) in order to make facilities at InputWindow(), otherwise this option will be fixed to increment always be +1. :?

Thank you for you attention.
Done!

Re: GRID - COLUMNCONTROLS

Posted: Thu Feb 19, 2015 2:28 pm
by serge_girard
Thanks to All !

Serge