Page 3 of 3

Re: HMG 3.0.23

Posted: Wed Mar 03, 2010 11:12 am
by Roberto Lopez
raumi75 wrote: Pgrdd has a way to read the primary keys. I have seen it in the source code. More precisely, we need a way, to find all columns with NOT NULL constraints. I will look into the source of pgrdd, to find something like that.

A few minutes ago, I thought, that a programmer will have to write VALID codeblocks by hand, that do the same as the server-side constraints. But your idea is a lot more intuitive. Look into the table-definition and let hmg generate that code. mmh. I like that. :) But it looks difficult.
It looks very difficult indeed :)

I guess that a first implementation could left in the hands of the programmer to write the adequate rules for a particular database/table.

So, the only problem could be to give to him the buffered data in an easy to use way.

Re: HMG 3.0.23

Posted: Wed Mar 03, 2010 11:15 am
by Roberto Lopez
raumi75 wrote: <...>
But that would be a huge task!

So, if we just had a ROWVALID codeblock in grid, a programer could write his own checking function.
I fully agree.

Re: HMG 3.0.23

Posted: Wed Mar 03, 2010 6:03 pm
by raumi75
Roberto Lopez wrote: So, the only problem could be to give to him the buffered data in an easy to use way.
I would expect it to be something like

Code: Select all

<ParentWindowName>.MyGrid.Cell(nRow,nCol)  --> CellContent
If I understand it right,

Code: Select all

<ParentWindowName>.MyGrid.Value
is the current row, so

Code: Select all

<ParentWindowName>.MyGrid.Cell(<ParentWindowName>.MyGrid.Value,nCol) 
will get me my Cell-Values.

Yours
Raumi

Re: HMG 3.0.23

Posted: Wed Mar 03, 2010 6:32 pm
by raumi75
Roberto Lopez wrote:
raumi75 wrote: So, if we just had a ROWVALID codeblock in grid, a programer could write his own checking function.
I fully agree.
Hello Roberto,

I experimented with the Grid-control and just had a different idea that makes this problem a lot easier (for hmg-programers) ;-).

You do not need ROWVALID, if grid simply enforced the COLUMNVALIDS no matter, if a user enters a specific cell or not.

I modified SAMPLE\GRID.25\ and added a COLUMNVALID.

Code: Select all

/*
* MiniGUI Virtual Grid Demo
* (c) 2009 Roberto Lopez
*/

#include "hmg.ch"

Function Main

Local aValue := { Nil , Nil }

	* Grid Column Controls Definitions

	aCtrl_1 := {'TEXTBOX','NUMERIC','9999999999'}
	aCtrl_2 := {'TEXTBOX','CHARACTER'}
	aCtrl_3 := {'TEXTBOX','CHARACTER'}
	aCtrl_4 := {'DATEPICKER','UPDOWN'}
	aCtrl_5 := { 'CHECKBOX' , 'Yes' , 'No' }
	aCtrl_6 := { 'EDITBOX' }

	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 'Set RecNo'				ACTION Form_1.Grid_1.RecNo := val(InputBox('','')) 
				ITEM 'Get RecNo'				ACTION MsgInfo( Str(Form_1.Grid_1.RecNo) )
				ITEM 'Delete (Alt+D)'				ACTION Form_1.Grid_1.Delete
				ITEM 'Recall (Alt+R)'				ACTION Form_1.Grid_1.Recall
				ITEM 'Get Value'				ACTION ( aValue := Form_1.Grid_1.Value , MsgInfo( Str( aValue [1] ) + ' , ' + Str( aValue [2] ) ) )
				ITEM 'Set Value'				ACTION ( aValue [ 1 ] :=  val(InputBox('New Row','Selected Cell (Value)')) , aValue [ 2 ] :=  val(InputBox('New Col','Selected Cell (Value)')) , Form_1.Grid_1.Value := { aValue [ 1 ] , aValue [ 2 ] } )
				ITEM 'Save Pending Changes (Alt+S)'		ACTION Form_1.Grid_1.Save
				ITEM 'Clear Changes Buffer (Undo) (ALt+U)'	ACTION Form_1.Grid_1.ClearBuffer
			END POPUP
		END MENU

		USE TEST SHARED
		INDEX ON CODE TO CODE

		@ 10,10 GRID Grid_1 ;
			WIDTH 770 ;
			HEIGHT 440 ;
			HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5','Column 6'} ;
			WIDTHS {140,140,140,100,100,100};
			EDIT ;
			VALUE { 1 , 1 } ;
			COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
                        COLUMNVALID 	{ ;
					{ || .t. } , ;
					{ || ! Empty ( This.CellValue ) } , ;
					{ || ! Empty ( This.CellValue ) } , ;
					{ || ! Empty ( This.CellValue ) } , ;
					{ || ! Empty ( This.CellValue ) } , ;
					{ || ! Empty ( This.CellValue ) } ;
					} ;
			ROWSOURCE "Test" ;
			COLUMNFIELDS { 'Code' ,  'First' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
			ALLOWAPPEND ;
			ALLOWDELETE 
		
	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return
I can add a new row (Alt+A), leave some cells empty and still save the record (Alt+S). That means, a user can violate the columnvalids, simply by never entering the cell.

This is a point that concerns people who do not use SQL, too.

I do not know if this makes it easier for you. ;-) But I think this would be the most straightforward way to deal with rules.

What do you think?

Raumi

Re: HMG 3.0.23

Posted: Fri Mar 05, 2010 2:33 pm
by Roberto Lopez
raumi75 wrote: <...>
I can add a new row (Alt+A), leave some cells empty and still save the record (Alt+S). That means, a user can violate the columnvalids, simply by never entering the cell.

This is a point that concerns people who do not use SQL, too.

I do not know if this makes it easier for you. ;-) But I think this would be the most straightforward way to deal with rules.

What do you think?
I'm working now on make some enhancements in basic grid operation for standard RDDs.

Later I'll start experimenting a little more in the best way to give a basic SQL RDDs support.

From those experiences information, I'll think which could be the best way to go for BOTH operations (dbf and SQL).

Thanks for your help on this.

Re: HMG 3.0.23

Posted: Fri Mar 05, 2010 4:41 pm
by raumi75
Roberto Lopez wrote:
<...>
I'm working now on make some enhancements in basic grid operation for standard RDDs.

Later I'll start experimenting a little more in the best way to give a basic SQL RDDs support.

From those experiences information, I'll think which could be the best way to go for BOTH operations (dbf and SQL).

Thanks for your help on this.
If fully agree. Standard RDDs are number one priority.

I am patiently waiting and do not mean to be pushy. If I can do anything (testing, etc.) just let me know.

Raumi