BROWSE - SABER FILA

HMG en Español

Moderator: Rathinagiri

User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

BROWSE - SABER FILA

Post by SALINETAS24 »

Hola a todos..., a ver si me se explicar.

Me gustaría saber en que posición de la pantalla me encuentro en un Browse cuando hago DobleClik.

He visto como localiza la Fila y la Columna en h_browse.prg pero no consigo que funcione, tengo problemas de acceso de Array con la variable de systema _HMG_SYSDATA

Si incluyo la linea

Code: Select all

AT This.CellRow + GridRow - _HMG_SYSDATA [ 18 ] [i] - 1 , This.CellCol + GridCol - _HMG_SYSDATA [ 19 ] [i] + 2 ;
que aparentemente me puede sacar de la miseria .., me da error en el array...
¿Alguien me puede decir como saber la fila donde se hace DBLClik sobre el Browse...?
Agradeciendo de antemano.., vamos con la cervecita!!!

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2002 Roberto Lopez <harbourminigui@gmail.com>
 * http://harbourminigui.googlepages.com/
*/


* Enjoy !

MEMVAR _HMG_SYSDATA
#include 'hmg.ch'


Function Main

	SET CENTURY ON

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 HEIGHT 480 ;
		TITLE 'MiniGUI Browse Demo' ;
		MAIN NOMAXIMIZE ;
		ON INIT OpenTables() ;
		ON RELEASE CloseTables()

		DEFINE MAIN MENU 
			POPUP 'File'
				ITEM 'Set Browse Value'	ACTION Form_1.Tab_1(1).Browse_1.Value := 50
				ITEM 'Get Browse Value'	ACTION MsgInfo ( Str (  Form_1.Tab_1(1).Browse_1.Value ) )
				ITEM 'Refresh Browse'	ACTION Form_1.Tab_1(1).Browse_1.Refresh
				SEPARATOR
				ITEM 'Show Browse'	ACTION Form_1.Tab_1(1).Browse_1.Show
				ITEM 'Hide Browse'	ACTION Form_1.Tab_1(1).Browse_1.Hide
				ITEM 'Enable Browse'	ACTION Form_1.Tab_1(1).Browse_1.Enabled := .t.
				ITEM 'Disable Browse'	ACTION Form_1.Tab_1(1).Browse_1.Enabled := .f.
				SEPARATOR
				ITEM 'Set Browse Row'	ACTION Form_1.Tab_1(1).Browse_1.Row := Val(InputBox("Row:"))
				ITEM 'Donde estoy??'	ACTION( MsgInfo ( Str (  Form_1.Tab_1(1).Browse_1.Row ) ) ,;
												MSGINFO (This.CellRow),;
												msginfo (I := ascan ( _HMG_SYSDATA [3] , "Browse_1" )),;
												MSGINFO (GetWIndowRow ("Browse_1") ),;
												MSGINFO (GetWIndowCol ("Browse_1") ) )
												
												
				ITEM 'Set Browse Col'	ACTION Form_1.Tab_1(1).Browse_1.Col := Val(InputBox("Col:"))
				ITEM 'Get Browse Col'	ACTION MsgInfo ( Str (  Form_1.Tab_1(1).Browse_1.Col ) )
				SEPARATOR
				ITEM 'Hide Label'	ACTION Form_1.Tab_1(2).Label_1.Hide
				ITEM 'Show Label'	ACTION Form_1.Tab_1(2).Label_1.Show

				SEPARATOR
				ITEM 'Exit'		ACTION Form_1.Release
			END POPUP
			POPUP 'Help'
				ITEM 'About'		ACTION MsgInfo ("MiniGUI Browse Demo") 
			END POPUP
		END MENU

		DEFINE STATUSBAR
			STATUSITEM 'HMG Power Ready!'
		END STATUSBAR

		DEFINE TAB Tab_1 ;
			AT 10,10 ;
			WIDTH 600 ;
			HEIGHT 400 ;
			VALUE 1 FONT 'ARIAL' SIZE 10

			PAGE '&Browse'

				@ 40,25 BROWSE Browse_1									;
				WIDTH 555  										;
				HEIGHT 350 										;	
				HEADERS { 'Code' , 'First Name' , 'Last Name', 'Birth Date', 'Married' , 'BioGraphy' }	;
				WIDTHS { 150 , 150 , 150 , 150 , 150 , 150 } 						;
				WORKAREA Test ;
				FIELDS { 'Test->Code' , 'Test->First' , 'Test->Last' , 'Test->Birth' , 'Test->Married' , 'Test->Bio' }	;
				VALUE 1 ;
				ON DBLCLICK MsgInfo('DoubleClick!!') ;
				ON HEADCLICK { {|| MsgInfo('Header 1 Clicked !')} , { || MsgInfo('Header 2 Clicked !')} , { || MsgInfo('Header 3 Clicked !')}, { || MsgInfo('Header 4 Clicked !')}, { || MsgInfo('Header 5 Clicked !')}, { || MsgInfo('Header 6 Clicked !')}}

			END PAGE

			PAGE '&More'

				@ 55,90 LABEL Label_1 ;
				VALUE 'Label !!!' ;
				WIDTH 100 HEIGHT 27 

				@ 80,90 CHECKBOX Check_1 ;
				CAPTION 'Check 1' ;
				VALUE .T. ;
				TOOLTIP 'CheckBox' 

				@ 115,85 SLIDER Slider_1 ;
				RANGE 1,10 ;
				VALUE 5 ;
				TOOLTIP 'Slider' 

				@ 45,240 FRAME TabFrame_2 WIDTH 125 HEIGHT 110 OPAQUE

				@ 50,260 RADIOGROUP Radio_1 ;
				OPTIONS { 'One' , 'Two' , 'Three', 'Four' } ;
				VALUE 1 ;
				WIDTH 100 ;
				TOOLTIP 'RadioGroup' 

			END PAGE

		END TAB

	END WINDOW

	CENTER WINDOW Form_1

	Form_1.Browse_1.SetFocus

	ACTIVATE WINDOW Form_1

Return Nil

Procedure OpenTables()
	Use Test 
Return Nil

Procedure CloseTables()
	Use
Return Nil

Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: BROWSE - SABER FILA

Post by serge_girard »

Amigo, this works for grids, so see if you can get it running!

Code: Select all

cKEY1 := ALLTRIM(ValorDaColuna( "Grid_1" ,  "Form_1" , 1 )) // is first column of the grid

Function ValorDaColuna( ControlName, ParentForm , nCol )
Local aRet := {}
If GetControlType (ControlName,ParentForm) != "GRID" // try browse...
	MsgBox( "SYSTEM EROR: Object is noGrid!!") 
	Return( aRet )
EndIf	
nCol := Iif( nCol == Nil .Or. nCol == 0 , 1 , nCol )
aRet := GetProperty (  ParentForm  , ControlName , 'Item' , GetProperty( ParentForm , ControlName , 'Value' ) )
Return( aRet[ nCol ] )	
Serge
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: BROWSE - SABER FILA

Post by mol »

Property value of Browse returns RecNo() in displayed DataBase
With Grid it's different - it's Value is an array type when you set CellNaviagation to .T., otherwise it should returm RecNo(), but it works bad from years.
I always use browse for dbf's and grid for arrays.
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: BROWSE - SABER FILA

Post by SALINETAS24 »

Hola mon amic...., muchas gracias por contestar.
Ya esta resuelto y es más facil de lo que yo pensaba..., lo que ocurre es que el valor solo se carga cuando se hace Doble Click sobre un registro del browse.

ON DBLCLICK MsgInfo(This.CellRow) ;

Asi ya podemos saber en que fila estamos..

Code: Select all

				@ 40,25 BROWSE Browse_1									;
				WIDTH 555  										;
				HEIGHT 350 										;	
				HEADERS { 'Code' , 'First Name' , 'Last Name', 'Birth Date', 'Married' , 'BioGraphy' }	;
				WIDTHS { 150 , 150 , 150 , 150 , 150 , 150 } 						;
				WORKAREA Test ;
				FIELDS { 'Test->Code' , 'Test->First' , 'Test->Last' , 'Test->Birth' , 'Test->Married' , 'Test->Bio' }	;
				VALUE 1 ;
				ON DBLCLICK MsgInfo(This.CellRow) ;
				ON HEADCLICK { {|| MsgInfo('Header 1 Clicked !')} , { || MsgInfo('Header 2 Clicked !')} , { || MsgInfo('Header 3 Clicked !')}, { || MsgInfo('Header 4 Clicked !')}, { || MsgInfo('Header 5 Clicked !')}, { || MsgInfo('Header 6 Clicked !')}}

Vamos con la cervecita..., y una copa de buen vino
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: BROWSE - SABER FILA

Post by SALINETAS24 »

Pues no funciona del todo.
Si le das Doble Click con el Raton carga el valor .., pero si le das ENTER en valor es CERO PATATERO... :cry:
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: BROWSE - SABER FILA

Post by serge_girard »

Sorry, but I never used the BROWSE; I allways take the records into an array and then to a GRID. In this way my DBF is closed and other users can read it.

Serge
There's nothing you can do that can't be done...
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: BROWSE - SABER FILA

Post by andyglezl »

Hola Salinetas

Tal vez con...

nRow := Main.Grid_1.CellRowClicked

viewtopic.php?f=13&t=6024&p=58560#p58560
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: BROWSE - SABER FILA

Post by SALINETAS24 »

Hola Andrés.., tampoco funciona. :|

Creo que seria buena la ayuda Roberto Lopez o Claudio Soto ya que la clase BROWSE la desarrollaron ellos. ;)
En dicha clase cuando haces dbl click o enter se produce la entrada de datos dibujando para cada celda un window.

No obstante he conseguido algo, por lo menos ya tengo la fila donde estoy :lol:

En el Browse.., cambia la linea del doble click por esta

Code: Select all

ON DBLCLICK  COMPRUEBA() ;
y añade esta función...

Code: Select all


Procedure COMPRUEBA()
local i,GRIDHANDLE ,GridRow,GridCol
	i := Ascan ( _HMG_SYSDATA [3] , GetFocus() )
	GRIDHANDLE :=_HMG_SYSDATA [3][i]
	msginfo( LISTVIEW_GETFIRSTITEM ( _HMG_SYSDATA [3] [i] ) )
RETURN

Cuando le des al ENTER o al DBLClick te dira la ficha en la que estás, y ahora con una formula matemática pues calculamos la fila y ya lo tenemos situado...,

Vamos con esa cervecita.... :D
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: BROWSE - SABER FILA

Post by SALINETAS24 »

Oye.., lo del GRIDHANDLE:=HMG_SYSDATE[3], en esta función no sirva para nada...
Saludos
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: BROWSE - SABER FILA

Post by franco »

I use browse all the time as it faster then grid on large tables.
I use onheadclick to get data of selected row. I do not use arrays that much but I think they are the same as field names of selected row.
All The Best,
Franco
Canada
Post Reply