Roberto Lopez wrote:
I'm very sorry, but I guess that I'm not understanding...
Please, send me a complete sample showing the situation when the value property returns a wrong value.
TIA.
I feel terrible, that I can't explain it easier. I will try to show my problem with a sample.
Given: I use a table called test. It has the columns garken (C), eigenschaft (C), wert (C) and id (N).
I took GRID.30 and modified it to use a postgresql-server. It works fine, when I use the dbf-table. But when I use a postgresql-table, the sample looks like this.
Code: Select all
/*
* MiniGUI Virtual Grid Demo
* (c) 2009 Roberto Lopez
*/
* Modified by raumi75 to show problem mit Postgresql
#include "hmg.ch"
#command USE <(db)> [VIA <rdd>] [ALIAS <a>] [<nw: NEW>] ;
[<ex: EXCLUSIVE>] [<sh: SHARED>] [<ro: READONLY>] ;
[CODEPAGE <cp>] [CONNECTION <nConn>] [INDEX <(index1)> [, <(indexN)>]] => ;
dbUseArea( <.nw.>, <rdd>, <(db)>, <(a)>, ;
if(<.sh.> .or. <.ex.>, !<.ex.>, NIL), <.ro.>, [<cp>], [<nConn>] ) ;
[; dbSetIndex( <(index1)> )] ;
[; dbSetIndex( <(indexN)> )]
Function Main
* Postgresql-Connection
request PGRDD
nConn := dbpgconnection( "192.168.1.101;databasename;username;password" )
* Dynamic Display
bdDisplay_1 := { || Upper(This.CellValue) }
bdDisplay_2 := { || Lower(This.CellValue) }
* Grid Column Controls Definitions
aCtrl_1 := {'TEXTBOX','CHARACTER'}
aCtrl_2 := {'TEXTBOX','CHARACTER'}
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
MAIN
DEFINE MAIN MENU
POPUP 'File'
ITEM 'Append (Alt+A)' ACTION Form_1.Grid_1.Append
ITEM 'Save Last Appended Record (Alt+S)' ACTION Form_1.Grid_1.Save
ITEM 'Set RecNo' ACTION Form_1.Grid_1.RecNo := val(InputBox('',''))
ITEM 'Get RecNo' ACTION MsgInfo( Str(Form_1.Grid_1.RecNo) )
ITEM 'Delete' ACTION Form_1.Grid_1.Delete
ITEM 'Recall' ACTION Form_1.Grid_1.Recall
END POPUP
END MENU
use "SELECT * FROM test WHERE garken = 'VISION ' ORDER BY id;" alias Test NEW via "pgrdd" connection nConn
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Column 1','Column 2'} ;
WIDTHS {140,140};
EDIT ;
VALUE { 1 , 1 } ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 } ;
ROWSOURCE "Test" ;
COLUMNFIELDS { 'eigenschaft' , 'wert'} ;
ALLOWAPPEND ;
BUFFERED ;
ALLOWDELETE ;
DYNAMICDISPLAY { bdDisplay_1 , bdDisplay_2 } ;
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
When I run the program, It displays very well. But: When trying to exit a field after editing it, I get the following error:
Code: Select all
Error BASE/1082 Argument error: -
Called from DATAGRIDREFRESH(2176)
Called from SAVEDATAGRIDFIELD(2145)
Called from _HMG_GRIDINPLACEEDITOK(1217)
Called from (b)_HMG_GRIDINPLACEEDIT(794)
Called from _DOCONTROLEVENTPROCEDURE(4919)
Called from EVENTS(563)
Called from _DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(4583)
Called from _HMG_GRIDINPLACEEDIT(963)
Called from EVENTS(2624)
Called from _DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(4561)
Called from MAIN(75)
The line number DATAGRIDREFRESH(2176) is different from your line number, because I fixed the RLOCK()-Postgresql-Bug and added the if empty(aValue [1]) lines which I quoted a few hours ago. It refers to the line
Code: Select all
nDeltaRow := LISTVIEW_GETTOPINDEX ( nHandle ) - aValue [1] + 1
in your file C:\hmg\SOURCE\h_grid.prg
aValue [1] is empty, so the "- Operation" fails.
I know, I sound confusing and I am sorry for not keeping it simpler.
Thank you for taking the time to listen to me.
Raumi