Row Refresh in a BROWSE

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Row Refresh in a BROWSE

Post by mol »

franco wrote: Tue Jun 30, 2020 5:11 pm Mol, I use for grid line number
formname.gridname.recno for grid record
formname.gridname.recno() for table record
not sure if it works for browse.
Not. In this way it doesn't work.

I investigated BROWSE control sources and I prepared function for refresh current row.
But, the problem is with numeric columns - they are empty after refreshing, so I decided to convert it to string by hb_ntos

Code: Select all

PROCEDURE RefreshBrowseLine(cForm, cBrowse)
	LOCAL i, iMax
	LOCAL cField, xValue
	local aStruc
	local h
	nIdx := GetControlIndex ( cBrowse, cForm )
	h := GetControlHandle ( cBrowse, cForm )
	nRow := LISTVIEW_GETFIRSTITEM ( h)	// this function returns current screen row number
	aStruc := _HMG_SYSDATA [ 31 ] [nIdx]	// array conainig FIELDS parameter
	iMax := LEN(aStruc)
	FOR i := 1 TO iMax
          cField := aStruc[ i ]
          xValue := &cField
	if valtype(xValue) == "N"
		xValue := hb_ntos(xValue)
	endif
 	SetProperty( cForm, cBrowse, "CELL", nRow, i, xValue )
       NEXT i
RETURN
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Row Refresh in a BROWSE

Post by Red2 »

Hi Marek,

Thank you very much for sharing your expertise and the fine work on your procedure!

Works great! Now there is an HMG procedure that updates just the current row of a simple HMG BROWSE.

Unfortunately when I run it in HMG-Extended (Harbour MiniGUI Extended Edition 20.05 (Update 2)) I get "Error BASE/1068 Argument error: array access".
The "Program Error" message suggests that it happens on this line:

Code: Select all

aStruc:= _HMG_SYSDATA [ 31 ] [ nIdx ]	// array containig FIELD names
Sorry, but I have yet to get HMG-Extended's debugger to work for me otherwise I would give more specifics.

Again, all of your generous help is greatly appreciated!

Warmest Regards,
Red2
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Row Refresh in a BROWSE

Post by AUGE_OHR »

hi,
mol wrote: Tue Jun 30, 2020 9:15 am "VALUE" property of BROWSE return record number in database, not row numer of BROWSE.
hm ... but i can "edit" it by DblClick this Way

Code: Select all

PROCEDURE EditDetail( cBroMacro, cWorkArea, cDbf, lEdit )
...
#IFDEF Use_DataBrowse // BROWSE
   nRecno := GetProperty( cBroMacro, "BrowserView", "Value" )
#ELSE                           // GRID
   nRecno := GetProperty( cBroMacro, "BrowserView", "RecNo" )
#ENDIF
The following data are available at ‘OnDblClick’ procedure:

- This.CellRowIndex
- This.CellColIndex
- This.CellRow
- This.CellCol
- This.CellWidth
- This.CellHeight
---

you are right that my Code only work on 1st Page ... but fail on 2nd Page of BROWSE ... hm
it seem that no more of "This" are implement in BROWSE like in GRID

Code: Select all

  nItem  := This.CellRowIndex
only work on 1st Page of BROWSE ... hm
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Row Refresh in a BROWSE

Post by AUGE_OHR »

hi,
Red2 wrote: Tue Jun 30, 2020 7:25 pm Unfortunately when I run it in HMG-Extended (Harbour MiniGUI Extended Edition 20.05 (Update 2)) I get "Error BASE/1068 Argument error: array access".
The "Program Error" message suggests that it happens on this line:

Code: Select all

aStruc:= _HMG_SYSDATA [ 31 ] [ nIdx ]	// array containig FIELD names
when create BROWSE you have

Code: Select all

   FIELDS aFeld
so you can pass "aFeld"

Code: Select all

   RefreshBrowseLine(cForm, cBrowse, aFeld)
---

_HMG_SYSDATA does not exist in Extended Version
BROWSE_HMG_EXT.JPG
BROWSE_HMG_EXT.JPG (194.41 KiB) Viewed 1609 times
HMG

Code: Select all

   aStruc := _HMG_SYSDATA [ 31 ] [nIdx]   // array conainig FIELDS parameter
Extended Version

Code: Select all

   aStruc := _HMG_aControlRangeMin [nIdx] // extended Version
have fun
Jimmy
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Row Refresh in a BROWSE

Post by franco »

I use table and ntx index. I wonder if this works different then idx or sql.
All The Best,
Franco
Canada
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Row Refresh in a BROWSE

Post by mol »

Remember that my solution is only for BROWSE, not for GRID
Post Reply