Hi friends,
Actually EDITBOX for ColumnControl only works for Grid in
ROWSOURCE (with database) !!
And even not been a grid for ROWSOURCE doesn't accept any value !
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 (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 (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):

- Screen2.png (242.13 KiB) Viewed 5629 times
I hope you enjoy it !
