Harbour MiniGUI 2.8.2

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

User avatar
gfilatov
Posts: 561
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 14 times
Been thanked: 126 times
Contact:

Re: Harbour MiniGUI 2.8.2

Post by gfilatov » Mon Apr 13, 2009 3:46 pm

esgici wrote:
gfilatov wrote: We have a Cell read/write property for that. :idea:

Sorry, where is selected :?:
Hi Esgici,

Take a look for the following working sample (function SetGridCell(row,col) especially):

Code: Select all

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

#include "minigui.ch"

Function Main

Local aRows [40] [3]


	SET CELLNAVIGATION ON

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 400 ;
		TITLE 'Mixed Data Type Grid Test' ;
		MAIN 

		DEFINE MAIN MENU
			DEFINE POPUP 'File'
				MENUITEM 'Set Value'	ACTION Form_1.Grid_1.Value := 5
				MENUITEM 'Get Value'	ACTION MsgInfo( Str ( Form_1.Grid_1.Value ) )
				SEPARATOR
				MENUITEM 'Set Value 5 Column 2'	ACTION SetGridCell(5,2)
				MENUITEM 'Set Value 10 Column 1'	ACTION SetGridCell(10,1)
				MENUITEM 'Set Value 40 Column 3'	ACTION SetGridCell(40,3)
			END POPUP
		END MENU

		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'} 

		aRows [21]	:= {'Fernandez','Raul','321-4332'} 
		aRows [22]	:= {'Borges','Javier','326-9430'} 
		aRows [23]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [24]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [25]	:= {'Batistuta','Gol','485-2843'} 
		aRows [26]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [27]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [28]	:= {'Samarbide','Armando','854-7873'} 
		aRows [29]	:= {'Pradon','Alejandra','???-????'} 
		aRows [30]	:= {'Reyes','Monica','432-5836'} 

		aRows [31]	:= {'Fernandez','Raul','321-4332'} 
		aRows [32]	:= {'Borges','Javier','326-9430'} 
		aRows [33]	:= {'Alvarez','Alberto','543-7898'} 
		aRows [34]	:= {'Gonzalez','Ambo','437-8473'} 
		aRows [35]	:= {'Batistuta','Gol','485-2843'} 
		aRows [36]	:= {'Vinazzi','Amigo','394-5983'} 
		aRows [37]	:= {'Pedemonti','Flavio','534-7984'} 
		aRows [38]	:= {'Samarbide','Armando','854-7873'} 
		aRows [39]	:= {'Pradon','Alejandra','???-????'} 
		aRows [40]	:= {'Reyes','Monica','432-5836'} 


		@ 10,10 GRID Grid_1 ;
			WIDTH 500 ;
			HEIGHT 322 ;
			HEADERS {'Column 1','Column 2','Column 3'} ;
			WIDTHS {100,100,100} ;
			ITEMS aRows ;
			VALUE 1 EDIT

	END WINDOW

	Form_1.grid_1.setfocus

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return Nil


Function SetGridCell(x,y)
Local i, z := GetGridColumnNumber( 'Form_1', 'Grid_1' )

	Form_1.Grid_1.Value := x

	if z > 1
		For i := 1 To z - 1
			INSERTLEFT()
			do events
		Next
	endif

	For i := 1 To y-1
		INSERTRIGHT()
		do events
	Next

Return Nil

FUNCTION GetGridColumnNumber( cWindowName, cGridName )
RETURN ( _HMG_SYSDATA [15] [ GetControlIndex ( cGridName , cWindowName ) ] )

*------------------------------------------------------------------------------*
* Low Level C Routines
*------------------------------------------------------------------------------*

#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"

HB_FUNC (INSERTLEFT)
{

			keybd_event(
			VK_LEFT	,	// virtual-key code
			0,		// hardware scan code
			0,		// flags specifying various function options
			0		// additional data associated with keystroke
			);

}

HB_FUNC (INSERTRIGHT)
{

			keybd_event(
			VK_RIGHT ,	// virtual-key code
			0,		// hardware scan code
			0,		// flags specifying various function options
			0		// additional data associated with keystroke
			);

}

#pragma ENDDUMP
I hope that helps.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Mon Apr 13, 2009 4:14 pm

Ok....

I've read all the messages (Grigory, Esgici, Rathinagiri).

I propose the following:

- 'Value' property will return an array with row and col selected for a grid only when Set CellNavigation is On.

- If no cell is selected, it will return {0,0} as result.

Property will be read/write.

As Grigory said, 'Cell' property allows read and write cell content for a grid.

Rathinagiri: 'Item' property already exists and allows to set or get an entire row via an 'n' elements array (when 'n' is the number of columns of the grid).

I'm listening...

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Rathinagiri
Posts: 5243
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 162 times
Been thanked: 161 times
Contact:

Post by Rathinagiri » Mon Apr 13, 2009 4:23 pm

Fantastic Roberto. That would be more than enough for me. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4459
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 336 times
Been thanked: 103 times
Contact:

Post by esgici » Mon Apr 13, 2009 5:26 pm

Roberto Lopez wrote: - 'Value' property will return an array with row and col selected for a grid only when Set CellNavigation is On.
- If no cell is selected, it will return {0,0} as result.
In universal :) language :

Code: Select all

  if IsCellNavigationOn 
     if IsSelectionMade
         value := { nSelectedRowNo, nSelectedColNo }  
     else
         value := { 0, 0}  
     endif
   else
     if IsSelectionMade
         value := nSelectedRowNo
     else
         value := 0
     endif
  endif
Property will be read/write.
After that there isn't anything to talk; that's all.

Thanks a lot Roberto :D

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Mon Apr 13, 2009 5:58 pm

Grigory, Rathinagiri, Esgici, All...


I've attached to this message 2.8.2 modified code with changes to value property in 'by cell' grids.

Merge H_windows.prg and h_controlmisc.prg with 2.8.2 an test it.

A demo is included too.

TIA.

Roberto.
Attachments
hmg283b.rar
(52.41 KiB) Downloaded 166 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Rathinagiri
Posts: 5243
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 162 times
Been thanked: 161 times
Contact:

Post by Rathinagiri » Mon Apr 13, 2009 6:05 pm

Thanks a lot Roberto. :)

One of my friends when leaving the college, wrote a note to me saying "Be a volcano!". And, I am seeing such a person being a volcano today. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Mon Apr 13, 2009 6:10 pm

rathinagiri wrote:Thanks a lot Roberto. :)

One of my friends when leaving the college, wrote a note to me saying "Be a volcano!". And, I am seeing such a person being a volcano today. :)
:)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
esgici
Posts: 4459
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 336 times
Been thanked: 103 times
Contact:

Post by esgici » Mon Apr 13, 2009 6:27 pm

rathinagiri wrote:Thanks a lot Roberto. :)

One of my friends when leaving the college, wrote a note to me saying "Be a volcano!". And, I am seeing such a person being a volcano today. :)
He isn't volcano, he is simply a ROY :!: !

But not by inheritance, by fist law :!:

It works fine, thanks a lot Roberto :D

Best Regards

--

Esgici
Attachments
Grid_22_Test.jpg
Test result for Selected Row/Col values in Grid Sample.
Grid_22_Test.jpg (34.57 KiB) Viewed 2096 times
Viva INTERNATIONAL HMG :D

User avatar
esgici
Posts: 4459
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 336 times
Been thanked: 103 times
Contact:

Post by esgici » Mon Apr 13, 2009 9:39 pm

Roberto Lopez wrote: I've attached to this message 2.8.2 modified code with changes to value property in 'by cell' grids.
A demo is included too.
Hi

I want make some experiments on this demo.

I had encountered some questions and can't find answer by myself :(

All of these are probably my faults. But more importantly ONCHANGE event doesn't triggering by column changing; works only by row changing; this may be normal behavior?

Sorry for delayed report after impatient confirmation :(

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Tue Apr 14, 2009 12:33 am

esgici wrote:
Roberto Lopez wrote: I've attached to this message 2.8.2 modified code with changes to value property in 'by cell' grids.
A demo is included too.
Hi

I want make some experiments on this demo.

I had encountered some questions and can't find answer by myself :(

All of these are probably my faults. But more importantly ONCHANGE event doesn't triggering by column changing; works only by row changing; this may be normal behavior?

Sorry for delayed report after impatient confirmation :(

Best Regards

--

Esgici
This code doesn't work because is not correct:
* IF IsControlDefined( "spnRow", "Form_1" ) // This doesn't work !

You've omitted the underscore '_' (_IsControlDefined) should be used if the arguments are strings.

The other problem is that I've not considered that OnChange event should be fired when selected column changes.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

Post Reply