Row Refresh in a BROWSE

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Red2
Posts: 273
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 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
User avatar
AUGE_OHR
Posts: 2061
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: 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
have fun
Jimmy
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Row Refresh in a BROWSE

Post by mol »

It's not working with BROWSE in my opinion
Red2
Posts: 273
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 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
User avatar
AUGE_OHR
Posts: 2061
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,

have you REPLACE Value in DBF before :?:
Browse_refresh_Current.gif
Browse_refresh_Current.gif (1.13 MiB) Viewed 2539 times
have fun
Jimmy
Red2
Posts: 273
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 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
User avatar
AUGE_OHR
Posts: 2061
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: 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
have fun
Jimmy
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Row Refresh in a BROWSE

Post 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.
Red2
Posts: 273
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,

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
franco
Posts: 818
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Row Refresh in a BROWSE

Post 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.
All The Best,
Franco
Canada
Post Reply