Alaska Software Inc. - RefreshRows() don't refresh
Username: Password:
AuthorTopic: RefreshRows() don't refresh
mikeRefreshRows() don't refresh
on Sat, 14 Mar 2009 16:50:21 +0100
hi, I tried to refresh a sigle row of xbpBrowse object with
oColumn:RefreshRows(), but data is not refreshed until i put cursor un it
(in that single cell). What is possibile cause?
Peter Alderliesten Re: RefreshRows() don't refresh
on Wed, 18 Mar 2009 13:06:12 +0100
Mike,

> hi, I tried to refresh a sigle row of xbpBrowse object with
> oColumn:RefreshRows(), but data is not refreshed until i put cursor un it
> (in that single cell). What is possibile cause?

This could be because the data of the row is automatically read with cursor
movement. But you could try:  
	oBrowse:refreshCurrent()   this refreshes the current row

and if that is not sufficient, follow it with an 
	oBrowse:forceStable()

Peter
mikeRe: RefreshRows() don't refresh
on Thu, 19 Mar 2009 07:27:39 +0100
Sorry, but in the first message i have make a mistake.
I want refresh a column, not a row, without refresh all the browse 
(refreshAll() - that work correctly - is too slow)
RefreshRows() method of column object would be more easy if I could use.

I have also tried to make an underlyer table, but time to construct is the 
same time to refreshAll.

..... anyway, thanks.


"Peter Alderliesten" <p.alderliesten@emergo-systems.nl> ha scritto nel 
messaggio news:1y97tbqjgu9k.1008atq1ibvep.dlg@40tude.net...
> Mike,
>
>> hi, I tried to refresh a sigle row of xbpBrowse object with
>> oColumn:RefreshRows(), but data is not refreshed until i put cursor un it
>> (in that single cell). What is possibile cause?
>
> This could be because the data of the row is automatically read with 
> cursor
> movement. But you could try:
> oBrowse:refreshCurrent()   this refreshes the current row
>
> and if that is not sufficient, follow it with an
> oBrowse:forceStable()
>
> Peter
Joe Carrick Re: RefreshRows() don't refresh
on Thu, 19 Mar 2009 12:57:46 -0800
Hi Mike,

I don't understand what data you are browsing.  You say that making an 
underlying table takes too much time but you must have one or more 
tables or one or more arrays in order to have some data to browse.

If you have 2 or 3 tables and want to create one browse with data 
calculated from fields of those tables you do not need to create a new 
table.  You can set up the datalink for each column to display the 
calculated value based on the appropriate aliased fields.

You really need to explain better what you are doing so we can help.

-Joe


mike wrote:
> Sorry, but in the first message i have make a mistake.
> I want refresh a column, not a row, without refresh all the browse 
> (refreshAll() - that work correctly - is too slow)
> RefreshRows() method of column object would be more easy if I could use.
> 
> I have also tried to make an underlyer table, but time to construct is the 
> same time to refreshAll.
> 
> ..... anyway, thanks.
> 
> 
> "Peter Alderliesten" <p.alderliesten@emergo-systems.nl> ha scritto nel 
> messaggio news:1y97tbqjgu9k.1008atq1ibvep.dlg@40tude.net...
>> Mike,
>>
>>> hi, I tried to refresh a sigle row of xbpBrowse object with
>>> oColumn:RefreshRows(), but data is not refreshed until i put cursor un it
>>> (in that single cell). What is possibile cause?
>> This could be because the data of the row is automatically read with 
>> cursor
>> movement. But you could try:
>> oBrowse:refreshCurrent()   this refreshes the current row
>>
>> and if that is not sufficient, follow it with an
>> oBrowse:forceStable()
>>
>> Peter 
> 
>
mikeRe: RefreshRows() don't refresh
on Sat, 21 Mar 2009 18:07:07 +0100
I browse a column with a database and the other from others.
A series of column are refered to date and in fuction of position of cursor 
(then different date) i want change data in column in question.

I have tryes, for testing function oColumn:refreshRows(), to link column to 
oColumn:dataLink  := {||  STR(Seconds()) }  and oBrowse:itemSelected := 
{|aPos,x,obj| oColumn:refreshRow() }
It was ineffective until i go on the cell (only in that cell).

Anyway thanks, i will take another way to do it (but wath is the use of that 
function?).
Mike.


"Joe Carrick" <joe.carrick@dslextreme.com> ha scritto nel messaggio 
news:52e14644$195153d9$ac9@news.alaska-software.com...
> Hi Mike,
>
> I don't understand what data you are browsing.  You say that making an 
> underlying table takes too much time but you must have one or more tables 
> or one or more arrays in order to have some data to browse.
>
> If you have 2 or 3 tables and want to create one browse with data 
> calculated from fields of those tables you do not need to create a new 
> table.  You can set up the datalink for each column to display the 
> calculated value based on the appropriate aliased fields.
>
> You really need to explain better what you are doing so we can help.
>
> -Joe
>
>
> mike wrote:
>> Sorry, but in the first message i have make a mistake.
>> I want refresh a column, not a row, without refresh all the browse 
>> (refreshAll() - that work correctly - is too slow)
>> RefreshRows() method of column object would be more easy if I could use.
>>
>> I have also tried to make an underlyer table, but time to construct is 
>> the same time to refreshAll.
>>
>> ..... anyway, thanks.
>>
>>
>> "Peter Alderliesten" <p.alderliesten@emergo-systems.nl> ha scritto nel 
>> messaggio news:1y97tbqjgu9k.1008atq1ibvep.dlg@40tude.net...
>>> Mike,
>>>
>>>> hi, I tried to refresh a sigle row of xbpBrowse object with
>>>> oColumn:RefreshRows(), but data is not refreshed until i put cursor un 
>>>> it
>>>> (in that single cell). What is possibile cause?
>>> This could be because the data of the row is automatically read with 
>>> cursor
>>> movement. But you could try:
>>> oBrowse:refreshCurrent()   this refreshes the current row
>>>
>>> and if that is not sufficient, follow it with an
>>> oBrowse:forceStable()
>>>
>>> Peter
>>
James Loughner Re: RefreshRows() don't refresh
on Sat, 21 Mar 2009 13:28:20 -0400
Data display values are not persistent. Still not sure what you want to
accomplish. Every time a refresh occurs the value would change in your
example. I think you are trying to push the browse model too far. Try
doing it with and underlying array which is updated on the itemselected
event.

Jim


mike wrote:
> I browse a column with a database and the other from others.
> A series of column are refered to date and in fuction of position of cursor 
> (then different date) i want change data in column in question.
> 
> I have tryes, for testing function oColumn:refreshRows(), to link column to 
> oColumn:dataLink  := {||  STR(Seconds()) }  and oBrowse:itemSelected := 
> {|aPos,x,obj| oColumn:refreshRow() }
> It was ineffective until i go on the cell (only in that cell).
> 
> Anyway thanks, i will take another way to do it (but wath is the use of that 
> function?).
> Mike.
> 
> 
> "Joe Carrick" <joe.carrick@dslextreme.com> ha scritto nel messaggio 
> news:52e14644$195153d9$ac9@news.alaska-software.com...
>> Hi Mike,
>>
>> I don't understand what data you are browsing.  You say that making an 
>> underlying table takes too much time but you must have one or more tables 
>> or one or more arrays in order to have some data to browse.
>>
>> If you have 2 or 3 tables and want to create one browse with data 
>> calculated from fields of those tables you do not need to create a new 
>> table.  You can set up the datalink for each column to display the 
>> calculated value based on the appropriate aliased fields.
>>
>> You really need to explain better what you are doing so we can help.
>>
>> -Joe
>>
>>
>> mike wrote:
>>> Sorry, but in the first message i have make a mistake.
>>> I want refresh a column, not a row, without refresh all the browse 
>>> (refreshAll() - that work correctly - is too slow)
>>> RefreshRows() method of column object would be more easy if I could use.
>>>
>>> I have also tried to make an underlyer table, but time to construct is 
>>> the same time to refreshAll.
>>>
>>> ..... anyway, thanks.
>>>
>>>
>>> "Peter Alderliesten" <p.alderliesten@emergo-systems.nl> ha scritto nel 
>>> messaggio news:1y97tbqjgu9k.1008atq1ibvep.dlg@40tude.net...
>>>> Mike,
>>>>
>>>>> hi, I tried to refresh a sigle row of xbpBrowse object with
>>>>> oColumn:RefreshRows(), but data is not refreshed until i put cursor un 
>>>>> it
>>>>> (in that single cell). What is possibile cause?
>>>> This could be because the data of the row is automatically read with 
>>>> cursor
>>>> movement. But you could try:
>>>> oBrowse:refreshCurrent()   this refreshes the current row
>>>>
>>>> and if that is not sufficient, follow it with an
>>>> oBrowse:forceStable()
>>>>
>>>> Peter
>
Joe Carrick Re: RefreshRows() don't refresh
on Sat, 21 Mar 2009 14:16:18 -0700
Mike!!!

:refreshrows() is not triggered until :itemselected

This means that either you have to physically select the column or cell 
- or you have to post the event yourself.  Since you already have 
underlying tables that contain the data from which the displayed browse 
is calculated the n what you MUST do is to properly define this 
calculation in the datalink codeblocks for each column based on the 
fields of the various tables.  I have said this before and I can't say 
it enough - :refreshCurrent() or :refreshAll() will do what you want and 
do it fast providing that the datalinks are properly defined.  It is 
only necessary to invoke one of these when data has changed.

IOW, if column 3 displays a caculated result based on the values of 
fields A,B & D then whenever data A, B or D is changed you call 
oBrowse:refreshCurrent() and all columns of the current row of the 
browse will be updated, including column 3.  Note that this only 
requires 1 calculation while :refreshrows() would require 1 calculation 
for each displayed row.

IAE, you can not rely on any of the :refresh.... methods being actually 
performed until something happens for which you have specifically coded 
a call to that method.  In your case, that is the :itemSelected message 
which will only happen when you click on the column.  That just isn't 
going to work for you, particularly if you have more than one column 
with calculated data to be displayed.  This is why I suggested 
:refreshCurrent() - it will redisplay all columns of the current row 
which corresponds to the current records - but each table must be 
positioned on the correct record and in order to do that you should have 
all tables synchronized by using a relationship based on a common index key.

Don't fight it.....

To answer your second question, the purpose of the :refreshRows() method 
is to redisplay all rows of a column based on something having happened 
that changes the data to be displayed.  That can happen if the browse is 
scrolled so that a new set of records correspond to the current browse 
position or if there's a calculation that should change the data in each 
row because underlying table data was changed someplace.  This of course 
is an extremely unlikely sort of calculation that would imply a table 
"turned on edge".

Usually I would think that oCol:refreshRows() is actually only needed 
(actually probably called directly) by oBrowse::refreshAll().

-Joe

mike wrote:
> I browse a column with a database and the other from others.
> A series of column are refered to date and in fuction of position of cursor 
> (then different date) i want change data in column in question.
>
> I have tryes, for testing function oColumn:refreshRows(), to link column to 
> oColumn:dataLink  := {||  STR(Seconds()) }  and oBrowse:itemSelected := 
> {|aPos,x,obj| oColumn:refreshRow() }
> It was ineffective until i go on the cell (only in that cell).
>
> Anyway thanks, i will take another way to do it (but wath is the use of that 
> function?).
> Mike.
>
>
> "Joe Carrick" <joe.carrick@dslextreme.com> ha scritto nel messaggio 
> news:52e14644$195153d9$ac9@news.alaska-software.com...
>   
>> Hi Mike,
>>
>> I don't understand what data you are browsing.  You say that making an 
>> underlying table takes too much time but you must have one or more tables 
>> or one or more arrays in order to have some data to browse.
>>
>> If you have 2 or 3 tables and want to create one browse with data 
>> calculated from fields of those tables you do not need to create a new 
>> table.  You can set up the datalink for each column to display the 
>> calculated value based on the appropriate aliased fields.
>>
>> You really need to explain better what you are doing so we can help.
>>
>> -Joe
>>
>>
>> mike wrote:
>>     
>>> Sorry, but in the first message i have make a mistake.
>>> I want refresh a column, not a row, without refresh all the browse 
>>> (refreshAll() - that work correctly - is too slow)
>>> RefreshRows() method of column object would be more easy if I could use.
>>>
>>> I have also tried to make an underlyer table, but time to construct is 
>>> the same time to refreshAll.
>>>
>>> ..... anyway, thanks.
>>>
>>>
>>> "Peter Alderliesten" <p.alderliesten@emergo-systems.nl> ha scritto nel 
>>> messaggio news:1y97tbqjgu9k.1008atq1ibvep.dlg@40tude.net...
>>>       
>>>> Mike,
>>>>
>>>>         
>>>>> hi, I tried to refresh a sigle row of xbpBrowse object with
>>>>> oColumn:RefreshRows(), but data is not refreshed until i put cursor un 
>>>>> it
>>>>> (in that single cell). What is possibile cause?
>>>>>           
>>>> This could be because the data of the row is automatically read with 
>>>> cursor
>>>> movement. But you could try:
>>>> oBrowse:refreshCurrent()   this refreshes the current row
>>>>
>>>> and if that is not sufficient, follow it with an
>>>> oBrowse:forceStable()
>>>>
>>>> Peter
>>>>         
>
>
Andreas Gehrs-Pahl
Re: RefreshRows() don't refresh
on Sun, 22 Mar 2009 12:07:58 -0400
Mike,

The XbpBrowse -- or more precisely, the XbpColumn -- Class doesn't have the
feature that you request, as it is designed mostly for showing static data.

But you can easily add this functionality -- showing dynamic data in one 
(or more) specific columns -- if you like.

Whenever you want to refresh (and redisplay) all the (visible) Rows of a
specific Column in an XbpBrowse -- without having to redisplay all the 
other (visible) Columns -- you can use the following routine:

Procedure RefreshColumn(oColumn)
LOCAL nRows := oColumn:RowCount()
LOCAL nRow  := 0
   oColumn:RefreshRows()
   for nRow := 1 to nRows
      if oColumn:DataArea:GetCell(nRow) # NIL
         oColumn:DrawRow(nRow)
      endif
   next nRow
   oColumn:Redraw()
return

The effect is similar to oBrowse:RefreshAll(), but only for that single
specified Column, so it is often much faster than oBrowse:RefreshAll(), 
especially if there are many Columns, many Rows, or some time-consuming 
calculations to redraw the other Columns.

You could also sub-class the XbpColumn and/or XbpBrowse Classes and add 
a new Method -- something like oBrowse:RefreshColumn() or maybe also 
oColumn:RedrawAll() -- instead of using an external Procedure.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---
Joe Carrick Re: RefreshRows() don't refresh
on Sun, 22 Mar 2009 11:54:44 -0700
Hi Andreas,

Actually, displaying dynamic data in a browse is pretty easy.  I use the 
following codeblocks for XbpColumn datalinks and they work fine:

First case:
    { || ONHAND * COST }
    This is really simple since only one database is involved - if 
either data is changed, I call refreshCurrent() to update the calculated 
data.

Second case:
    { || Inventory->COST * Order->QTY_ORD }
    More complicated - see explanation below - the advantage is that the 
Order does not need to contain the COST.  If COST is changed in 
Inventory or QTYORD is changed in Order the browse displays the correct 
information.
 
The only key is that in the second case the Inventory must be properly 
synchronized with the Order.  ie:  Both databases have to be positioned 
on the same Itemno.  It doesn't matter how you get the databases 
positioned on the correct records except that using indexes and 
relations is the easiest because it's automatic and will be correct for 
each row of the browse.

-Joe

Andreas Gehrs-Pahl wrote:
> Mike,
>
> The XbpBrowse -- or more precisely, the XbpColumn -- Class doesn't have the
> feature that you request, as it is designed mostly for showing static data.
>
> But you can easily add this functionality -- showing dynamic data in one 
> (or more) specific columns -- if you like.
>
> Whenever you want to refresh (and redisplay) all the (visible) Rows of a
> specific Column in an XbpBrowse -- without having to redisplay all the 
> other (visible) Columns -- you can use the following routine:
>
> Procedure RefreshColumn(oColumn)
> LOCAL nRows := oColumn:RowCount()
> LOCAL nRow  := 0
>    oColumn:RefreshRows()
>    for nRow := 1 to nRows
>       if oColumn:DataArea:GetCell(nRow) # NIL
>          oColumn:DrawRow(nRow)
>       endif
>    next nRow
>    oColumn:Redraw()
> return
>
> The effect is similar to oBrowse:RefreshAll(), but only for that single
> specified Column, so it is often much faster than oBrowse:RefreshAll(), 
> especially if there are many Columns, many Rows, or some time-consuming 
> calculations to redraw the other Columns.
>
> You could also sub-class the XbpColumn and/or XbpBrowse Classes and add 
> a new Method -- something like oBrowse:RefreshColumn() or maybe also 
> oColumn:RedrawAll() -- instead of using an external Procedure.
>
> -- Andreas
>
> ---                                                                      ---
>   Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
>   415 Gute Street                     or: Andreas@DDPSoftware.com
>   Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
>   Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
> ---                                                                      ---
>
Andreas Gehrs-Pahl
Re: RefreshRows() don't refresh
on Mon, 23 Mar 2009 19:53:29 -0400
Joe,

>Actually, displaying dynamic data in a browse is pretty easy. I use the 
>following codeblocks for XbpColumn datalinks and they work fine:

Your examples aren't really dynamic data as much as calculated values.

The XbpColumn Class has some methods that imply (by their names) that 
they could be used to refresh the contents of a Column in an XbpBrowse
table at will. But those methods, specifically "XbpColumn:RefreshRow()"
and "XbpColumn:RefreshRows()" do not work the same way as the similarly
named methods of the XbpBrowse, like "XbpBrowse:RefreshCurrent()" and
"XbpBrowse:RefreshAll()".

The XbpColumn methods only update an internal array and mark Rows of 
the Column as "to be re-drawn". The problem is, that they are never
redrawn, if no movement is done in the browse table, and even then,
they are not updated unless those Rows need to be re-drawn for other
reasons, like a screen refresh. And that's exactly what they are 
(apparently) designed for -- screen refresh.

If the values in one (or more) Columns need to be refreshed because
their value is dynamic -- for example based on the Time() or Seconds()
functions -- and you want to refresh them on demand or maybe even 
continually in some sort of a loop (like a timer thread), then you
have only two options. The first option is of course to use the 
XbpBrowse:RefreshAll() method, but this will also re-read all other
(visible) columns and rows and might require database access, including
skipping to the first (visible) top record and then skipping through
all the other records. And redrawing all cells of a browse might take
significantly longer than redrawing only the cells of a single Column.
This might not only be slow, especially if you want to do this once 
every second, but could result in a lot of unnecessary flickering. 

The only other option is to use the little routine that I have posted. 
This will only update all the Cells/Rows of the selected Column, and 
doesn't require the re-drawing, re-reading or re-calculating of any 
other cells in any of the other columns. If the data link doesn't 
contain any database fields, it might not even require any skipping 
or record pointer movement at all.

The same is true for arrays, where some array values are updated in the
background. To refresh the contents of the browse table -- and view the
updated array -- you need to always refresh the entire table, even if 
only values in a single column have changed.

Anyway, updating the contents of (only) a single column can only be done 
with the routine that I posted (or something similar), as the XbpColumn
Class doesn't have a method for that. I'm not quite sure what a real-
world scenario would look like, but this is the only practical way to
achieve such a "dynamic" XbpColumn behavior.

The "XbpBrowse:RefreshAll()" method allows a dynamic XbpBrowse, while
the "XbpBrowse:RefreshCurrent()" method allows a dynamic Row (or record),
but for dynamic XbpColumns, you need my "RefreshColumn(oColumn)" routine.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---
Joe Carrick Re: RefreshRows() don't refresh
on Mon, 23 Mar 2009 17:03:15 -0700
What you say is true about XbpColumn:refreshrow() and 
XbpColumn:refreshrows() only in that they onbly work when explicitely 
called.  In most instances that only happens on the itemMarked 
callback.  If you use a derive XbpBrowse Class with specific Get classes 
as I do it's possible to call these methods as data is changed.  My 
MxGet Class has 2 special iVars [::controller and ::browser] which if 
not empty point to the Column and the Browser.   Whenever the Get is 
going to loose focus the XbpColumn methods can be called to cause the 
refresh.

-Joe

Andreas Gehrs-Pahl wrote:
> Joe,
>
>   
>> Actually, displaying dynamic data in a browse is pretty easy. I use the 
>> following codeblocks for XbpColumn datalinks and they work fine:
>>     
>
> Your examples aren't really dynamic data as much as calculated values.
>
> The XbpColumn Class has some methods that imply (by their names) that 
> they could be used to refresh the contents of a Column in an XbpBrowse
> table at will. But those methods, specifically "XbpColumn:RefreshRow()"
> and "XbpColumn:RefreshRows()" do not work the same way as the similarly
> named methods of the XbpBrowse, like "XbpBrowse:RefreshCurrent()" and
> "XbpBrowse:RefreshAll()".
>
> The XbpColumn methods only update an internal array and mark Rows of 
> the Column as "to be re-drawn". The problem is, that they are never
> redrawn, if no movement is done in the browse table, and even then,
> they are not updated unless those Rows need to be re-drawn for other
> reasons, like a screen refresh. And that's exactly what they are 
> (apparently) designed for -- screen refresh.
>
> If the values in one (or more) Columns need to be refreshed because
> their value is dynamic -- for example based on the Time() or Seconds()
> functions -- and you want to refresh them on demand or maybe even 
> continually in some sort of a loop (like a timer thread), then you
> have only two options. The first option is of course to use the 
> XbpBrowse:RefreshAll() method, but this will also re-read all other
> (visible) columns and rows and might require database access, including
> skipping to the first (visible) top record and then skipping through
> all the other records. And redrawing all cells of a browse might take
> significantly longer than redrawing only the cells of a single Column.
> This might not only be slow, especially if you want to do this once 
> every second, but could result in a lot of unnecessary flickering. 
>
> The only other option is to use the little routine that I have posted. 
> This will only update all the Cells/Rows of the selected Column, and 
> doesn't require the re-drawing, re-reading or re-calculating of any 
> other cells in any of the other columns. If the data link doesn't 
> contain any database fields, it might not even require any skipping 
> or record pointer movement at all.
>
> The same is true for arrays, where some array values are updated in the
> background. To refresh the contents of the browse table -- and view the
> updated array -- you need to always refresh the entire table, even if 
> only values in a single column have changed.
>
> Anyway, updating the contents of (only) a single column can only be done 
> with the routine that I posted (or something similar), as the XbpColumn
> Class doesn't have a method for that. I'm not quite sure what a real-
> world scenario would look like, but this is the only practical way to
> achieve such a "dynamic" XbpColumn behavior.
>
> The "XbpBrowse:RefreshAll()" method allows a dynamic XbpBrowse, while
> the "XbpBrowse:RefreshCurrent()" method allows a dynamic Row (or record),
> but for dynamic XbpColumns, you need my "RefreshColumn(oColumn)" routine.
>
> -- Andreas
>
> ---                                                                      ---
>   Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
>   415 Gute Street                     or: Andreas@DDPSoftware.com
>   Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
>   Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
> ---                                                                      ---
>
Andreas Gehrs-Pahl
Re: RefreshRows() don't refresh
on Mon, 23 Mar 2009 22:07:49 -0400
Joe,

>What you say is true about XbpColumn:refreshrow() and 
>XbpColumn:refreshrows() only in that they onbly work when explicitely 
>called.

I'm not sure what you are saying, but I don't think you understand the
problem (that Mike had). Those methods work perfectly fine, but they
don't refresh or redraw anything, no matter when or how you call them,
as they are not supposed to do that.

>In most instances that only happens on the itemMarked callback.

I have never used those methods before, and I have no idea why you want
to call them in an ItemMarked Callback. BTW, what object's ItemMarked 
Callback slot are we talking about? The XbpBrowse, an XbpColumn, or 
something else?

>If you use a derive XbpBrowse Class with specific Get classes 
>as I do it's possible to call these methods as data is changed. My 
>MxGet Class has 2 special iVars [::controller and ::browser] which if 
>not empty point to the Column and the Browser. Whenever the Get is 
>going to loose focus the XbpColumn methods can be called to cause the 
>refresh.

Of course you can call those methods -- if you have a derived XbpBrowse 
Class or not -- but they still won't re-draw or refresh anything by 
themselves! They simply update one or more items in the (protected) 
XbpColumn:RefreshRows array. Only if you also call the XbpColumn:DrawRow() 
method for each of the affected Rows (or Cells) of the Column and finally 
also call the XbpColumn:Redraw() method, will the display be updated.

If you call XbpColumn:RefreshRows() and then re-size the XbpBrowse or
(partially) cover the column with a different dialog, the column is also 
redrawn, but not by itself!

I have included a small example, based on the FBrowse.prg in the Xbase++
"C:\Alaska\XPPW32\Source\Samples\Basics\GuiBrow\" directory. It has a
small pop-up menu (with right mouse click) and will also react to key
strokes. If you use ALT+5, the last column is refreshed, showing the
current value of Seconds() in all rows. If you use ALT+6, nothing happens
unless you resize the browse, click into one of the cells of the last
column or force a redraw by some other means. If you use ALT+7, the 
current row/record is refreshed, and if you use ALT+8, the entire browse
is refreshed.

Compare ALT+5 with ALT+8, and you should see the difference: no flicker
and all values are identical with ALT+5 (my procedure), why with ALT+8
(RefreshAll) there is some flicker and the last column shows different
values in different cells/rows, as the redraw is "much" slower.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---


RefreshRows.zip
Joe Carrick Re: RefreshRows() don't refresh
on Mon, 23 Mar 2009 20:33:02 -0700
Hi Andreas,

Andreas Gehrs-Pahl wrote:
> Joe,
>
>   
>> What you say is true about XbpColumn:refreshrow() and 
>> XbpColumn:refreshrows() only in that they onbly work when explicitely 
>> called.
>>     
>
> I'm not sure what you are saying, but I don't think you understand the
> problem (that Mike had). Those methods work perfectly fine, but they
> don't refresh or redraw anything, no matter when or how you call them,
> as they are not supposed to do that.
>
>   
According to the docs, they are supposed to do exactly that....

******************************************


  :refreshRows()

Refreshes one or more rows in the data area of the column.

:refreshRows( [<nFirstRow>], [<nLastRow>] ) --> self


      Parameters

<nFirstRow>

    This numeric parameter indicates the first row in the data area to
    be refreshed. It defaults to 1.

<nLastRow>

    This numeric parameter indicates the last row in the data area to be
    refreshed. It defaults to /:rowCount()/.


      Return

The method returns the object executing the method.


      Description

*/:refreshRows()/* invalidates the data contained in the specified data 
rows, causing the XbpColumn to reread the data from the data source for 
these rows and to display them in the browse window.

************************************

I haven't compiled and run your sample, but on the assumption that you 
are correct then this is a bug.  The docs indicate that the XbpColumn 
displays the data in the specified rows.  If it doesn't update the 
display then that forced redisplay is missing in this method.  Since I 
don't have the code for :refreshRows() I can't say why it would not 
work.  Perhaps it's due to a modification made somewhere along the line 
and the actual call to :redraw was moved from this method to the 
refreshCurrent() and refreshAll() methods.

I'll try your sample tomorrow and see what really happens.

-Joe


> --                                                                      ---
Joe Carrick Re: RefreshRows() don't refresh
on Mon, 23 Mar 2009 20:48:14 -0700
For the record - oCol:dataArea:drawCell( aRows ) should be performed by 
oCol:refreshRows()
If it isn't then it's a bug and needs to be fixed.

-Joe
mikeRe: RefreshRows() don't refresh
on Wed, 25 Mar 2009 08:04:30 +0100
Yes, Andreas has centred the question .........
I've supposed that what mentioned in the help file about refreshrows() was 
correct::

"invalidates the data contained in the specified data
rows, causing the XbpColumn to reread the data from the data source for
these rows and to display them in the browse window"

.....but it is not true.
Now i have take another way, but I'm intersested to know if it's really a 
bug or not.
Thank to all, Mike.

<Andreas Gehrs-Pahl> ha scritto nel messaggio 
news:1ty0czjyy0ag7.940uuf3f20j2.dlg@40tude.net...
> Joe,
>
>>What you say is true about XbpColumn:refreshrow() and
>>XbpColumn:refreshrows() only in that they onbly work when explicitely
>>called.
>
> I'm not sure what you are saying, but I don't think you understand the
> problem (that Mike had). Those methods work perfectly fine, but they
> don't refresh or redraw anything, no matter when or how you call them,
> as they are not supposed to do that.
>
>>In most instances that only happens on the itemMarked callback.
>
> I have never used those methods before, and I have no idea why you want
> to call them in an ItemMarked Callback. BTW, what object's ItemMarked
> Callback slot are we talking about? The XbpBrowse, an XbpColumn, or
> something else?
>
>>If you use a derive XbpBrowse Class with specific Get classes
>>as I do it's possible to call these methods as data is changed. My
>>MxGet Class has 2 special iVars [::controller and ::browser] which if
>>not empty point to the Column and the Browser. Whenever the Get is
>>going to loose focus the XbpColumn methods can be called to cause the
>>refresh.
>
> Of course you can call those methods -- if you have a derived XbpBrowse
> Class or not -- but they still won't re-draw or refresh anything by
> themselves! They simply update one or more items in the (protected)
> XbpColumn:RefreshRows array. Only if you also call the XbpColumn:DrawRow()
> method for each of the affected Rows (or Cells) of the Column and finally
> also call the XbpColumn:Redraw() method, will the display be updated.
>
> If you call XbpColumn:RefreshRows() and then re-size the XbpBrowse or
> (partially) cover the column with a different dialog, the column is also
> redrawn, but not by itself!
>
> I have included a small example, based on the FBrowse.prg in the Xbase++
> "C:\Alaska\XPPW32\Source\Samples\Basics\GuiBrow\" directory. It has a
> small pop-up menu (with right mouse click) and will also react to key
> strokes. If you use ALT+5, the last column is refreshed, showing the
> current value of Seconds() in all rows. If you use ALT+6, nothing happens
> unless you resize the browse, click into one of the cells of the last
> column or force a redraw by some other means. If you use ALT+7, the
> current row/record is refreshed, and if you use ALT+8, the entire browse
> is refreshed.
>
> Compare ALT+5 with ALT+8, and you should see the difference: no flicker
> and all values are identical with ALT+5 (my procedure), why with ALT+8
> (RefreshAll) there is some flicker and the last column shows different
> values in different cells/rows, as the redraw is "much" slower.
>
> -- Andreas
>
> ---                                                                      ---
>  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
>  415 Gute Street                     or: Andreas@DDPSoftware.com
>  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
>  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
> ---                                                                      ---
mikeRe: RefreshRows() don't refresh
on Wed, 25 Mar 2009 08:55:15 +0100
>
> I have never used those methods before, and I have no idea why you want
> to call them in an ItemMarked Callback. BTW, what object's ItemMarked
> Callback slot are we talking about? The XbpBrowse, an XbpColumn, or
> something else?
>

My idea is use a organizer that in function of column selected (date of 
special calenary) can change dinamically data on a column that contain for 
sample a quantity contained in another database.

>
> I have included a small example, based on the FBrowse.prg in the Xbase++
> "C:\Alaska\XPPW32\Source\Samples\Basics\GuiBrow\" directory. It has a
> small pop-up menu (with right mouse click) and will also react to key
> strokes. If you use ALT+5, the last column is refreshed, showing the
> current value of Seconds() in all rows. If you use ALT+6, nothing happens
> unless you resize the browse, click into one of the cells of the last
> column or force a redraw by some other means. If you use ALT+7, the
> current row/record is refreshed, and if you use ALT+8, the entire browse
> is refreshed.
>
> Compare ALT+5 with ALT+8, and you should see the difference: no flicker
> and all values are identical with ALT+5 (my procedure), why with ALT+8
> (RefreshAll) there is some flicker and the last column shows different
> values in different cells/rows, as the redraw is "much" slower.
>

I've tried your sample and I'm sorry to tell you that work only partially.
It seem to be right at first look, but if you link    oBrowse:AddColumn({|| 
Seconds()*AnotherFieldOfBrowsedRow}, 8, "Seconds") you will see that result 
is a refresh, but with all the same value (with seconds() function is not 
possible understand it because it's too fast and naturally column has anyway 
the same value).
Mike
Andreas Gehrs-Pahl
Re: RefreshRows() don't refresh
on Wed, 25 Mar 2009 10:50:50 -0400
Mike,

>I've tried your sample and I'm sorry to tell you that work only partially.
>It seem to be right at first look, but if you link oBrowse:AddColumn({|| 
>Seconds()*AnotherFieldOfBrowsedRow}, 8, "Seconds") you will see that result 
>is a refresh, but with all the same value (with seconds() function is not 
>possible understand it because it's too fast and naturally column has anyway 
>the same value).

On second thought, I think this should be expected -- and is probably the
reason why ":RefreshRow[s]()" isn't doing anything, unless a re-draw is
required. Whenever a redraw/refresh is required, the Cell is re-drawn from
an internal buffer, rather than executing the data link. And even if the
data link is executed -- if the buffer is empty, invalid, or differs from
the data link value -- it will simply re-read and/or re-calculate the data
from the current Database Record (or Array Item).

Obviously, an XbpColumn object doesn't have any navigation methods, and 
will therefore not skip through the Database (or Array)! So, my little
routine, which forces a synchronous re-draw/re-fresh of all Rows of a 
single column, will not skip through all the (visible) records. That's 
why, even though the data link is re-executed -- because I invalidated 
the internal buffer -- the value of all Rows will be based on the current 
Database Record (or Array Item) that is selected in the XbpBrowse and 
identified by the XbpBrowse:RowPos value. But keep in mind that the 
XbpBrowse:RowPos value isn't necessarily the record pointer (or Array 
Index) of the data source(s)!

Basically, if the data link of your (dynamic) Column is based on values 
from other fields (or varies for each record/row), you would be better 
off with using the XbpBrowse:RefreshAll() method, rather than writing 
your own navigation routines just for the column, which also have to be 
synchronized with the XbpBrowse navigation, of course.

Alternatively, if your data-link would be based on some other Column's 
(buffered) values -- even though I don't think this is possible -- then 
you might get the expected results without having to skip through the 
data source. Of course, I don't have any idea how this could be achieved
or how such a data link would look like.

Of course, you could always write your own routines or classes, but I
would simply use XbpBrowse:RefreshAll(), as it already does all that you
want, and only adds a little bit of overhead, by having to update all 
(visible) columns.

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---