Page 2 of 3

Re: Row Refresh in a BROWSE

Posted: Sun Jun 28, 2020 4:05 pm
by Red2
Hi Gabor,

SUCCESS! Thank you so much for sharing your HMG expertise. Your solution works great. I can live with the browse "flickering".

Again, thanks for your help. It is really appreciated!

Best Regards,
Red2

Re: Row Refresh in a BROWSE

Posted: Sun Jun 28, 2020 9:27 pm
by AUGE_OHR
hi,
mol wrote: Sun Jun 28, 2020 9:12 am Is it valid for BROWSE control?
you are right

Code: Select all

DoMethod(cBroMacro, "BrowserView","Refresh",.T.)
still flicker so try this

Code: Select all

   RefreshCurrent(cBroMacro, "BrowserView")

PROCEDURE RefreshCurrent(cForm,cBrowse)
LOCAL hBrowse := GetControlHandle(cBrowse, cForm )
LOCAL nRecord := GetProperty( cForm, cBrowse, "VALUE" )
   ListView_RedrawItems( hBrowse, nRecord, nRecord )
RETURN

Re: Row Refresh in a BROWSE

Posted: Mon Jun 29, 2020 12:12 pm
by mol
It's not working with BROWSE in my opinion

Re: Row Refresh in a BROWSE

Posted: Mon Jun 29, 2020 1:47 pm
by Red2
Hi Jimmy,

Thank you for your reply and suggestion. I added your code. My form's name is "DataBrowse" and the BROWSE's name is "BrowseStates".

Unfortunately it produced no refresh at all. (Perhaps my calling parameters are not correct):

Code: Select all

RefreshCurrent( "DataBrowse", "BrowseStates" )
It would be very nice if HMG could refresh only the BROWSE's altered record.
If you have any further suggestions I would really appreciate hearing them.

Regards
Red2

Re: Row Refresh in a BROWSE

Posted: Mon Jun 29, 2020 6:09 pm
by AUGE_OHR
hi,

have you REPLACE Value in DBF before :?:
Browse_refresh_Current.gif
Browse_refresh_Current.gif (1.13 MiB) Viewed 2810 times

Re: Row Refresh in a BROWSE

Posted: Mon Jun 29, 2020 6:52 pm
by Red2
Hi Jimmy,

Thank you for your quick reply, I really appreciate it! Am I understanding your question correctly? I:
1) Replace the field value
2) Set flag llRefresh
3) Then, if TRUE, call function RefreshCurrent()

My code follows:

Code: Select all

function ToPrintToggle( p_lPrint)
select "By_State"
local llRefresh := .F.
    if ( p_lPrint )        // TRUE
        if ( upper( By_State->MergeState ) != "Y" )
            replace By_State->MergeState with "Y"    // <--- REPLACEMENT
            llRefresh := .T.
        endif
    else        //    FALSE
        if ( By_State->MergeState != " " )
            replace By_State->MergeState with " "    // <--- REPLACEMENT
            llRefresh := .T.
        endif
    endif
    if ( llRefresh )
        RefreshCurrent( "DataBrowse", "BrowseStates" )
    endif
return Nil
QUESTION: What am I missing here?

Thanks again,
Red2

Re: Row Refresh in a BROWSE

Posted: Mon Jun 29, 2020 11:05 pm
by AUGE_OHR
hi,
mol wrote: Mon Jun 29, 2020 12:12 pm It's not working with BROWSE in my opinion
your are right, Code was for GRID and does not refresh with BROWSE

i use DBF with virtual GRID which display faster while it must not read DBF -> Array -> Refresh
so here Code for Array or DBF using GRID or BROWSE

Code: Select all

   ACTIVATE WINDOW &oBroEdit

   DoFindWin( cDBF )

   #IFDEF Use_DataBrowse
      Refreshline(cBroMacro,"BrowserView",aStruc)
   #ELSE
      RefreshCurrent(cBroMacro, "BrowserView")
   #ENDIF

RETURN

Code: Select all

STATIC PROCEDURE Refreshline(cForm,cBrowse,aStruc)
LOCAL ii, iMax := LEN(aStruc)
LOCAL nRow := GetProperty( cForm,cBrowse,"VALUE")
LOCAL cField,nPosi,xValue

   FOR ii := 1 TO iMax
      cField := aStruc[ ii ] [ DBS_NAME ]
      nPosi := FIELDPOS( cField )
      xValue := FIELDGET(nPosi)
      SetProperty( cForm, cBrowse, "CELL", nRow, ii, xValue )
   NEXT
RETURN

Code: Select all

STATIC PROCEDURE RefreshCurrent(cForm,cBrowse)
LOCAL hBrowse := GetControlHandle(cBrowse, cForm )
LOCAL nRecord := GetProperty( cForm, cBrowse, "VALUE" )
   ListView_RedrawItems( hBrowse, nRecord, nRecord )
RETURN

Re: Row Refresh in a BROWSE

Posted: Tue Jun 30, 2020 9:15 am
by mol
Hi Jimmy!
Your sample for BROWSE control is not correct.
"VALUE" property of BROWSE return record number in database, not row numer of BROWSE.
So, it can work only if your database is not indexed and you don't have deleted rows or you use SET DELETED OFF.

I don't know property which shows line number of browse.

Re: Row Refresh in a BROWSE

Posted: Tue Jun 30, 2020 3:10 pm
by Red2
Hi,

An interesting observation: In HMG-Extended when I execute

Code: Select all

    DoMethod( "DataBrowse", "BrowseStates", "Refresh" )
I detect zero REFRESH "flickering" in my BROWSE.
At this moment I am still using "Harbour MiniGUI Extended Edition 20.05 (Update 2)".

Nevertheless it would still be nice if there was a HMG "flickering" solution.

Regards,
Red2

Re: Row Refresh in a BROWSE

Posted: Tue Jun 30, 2020 5:11 pm
by franco
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.