FWH 8.10 and xBrowse (bug ?)

FWH 8.10 and xBrowse (bug ?)

Postby Marco Turco » Wed Oct 22, 2008 12:24 pm

Hi,
there is a problem with xbrowse when I change the array values.

Pls. take a look at this self-contained sample that show the problem.
Simply press the button "Change values" and you will see that the data remains unchanged. With FWH May 2008 it runs fine.

Any ideas ?

---------------------

#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()
local aNames, oBrw, oBtn, oDlg

aNames:=GetData()

DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 40,40

@1,1 XBROWSE oBrw ARRAY aNames of oDlg

ADD COLUMN TO XBROWSE oBrw DATA oBrw:nArrayAt();
HEADER "Num" SIZE 60 RIGHT

ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Name" SIZE 80

ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Floor" SIZE 80

ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 3;
HEADER "House" SIZE 80 RIGHT

oBrw:CreateFromCode()

@10,1 button "Change value" of odlg;
ACTION (aNames:=GetData1(), oBrw:SetArray(aNames),oBrw:Refresh())

ACTIVATE dialog oDlg


function GetData()
local aNames
aNames:=array(0,4)
aadd(aNames,{"Marc1","1th Floor","1Queens "})
aadd(aNames,{"Marc2","3th Floor","2Queens House"})
aadd(aNames,{"Marc3","2th Floor","3Queens House"})
aadd(aNames,{"Marc4","0th Floor","4Queens House"})
return(aNames)

function GetData1()
local aNames
aNames:=array(0,4)
aadd(aNames,{"Luc1","1th Floor","1Queens "})
aadd(aNames,{"Luc2","3th Floor","2Queens House"})
aadd(aNames,{"Luc3","2th Floor","3Queens House"})
aadd(aNames,{"Luc4","0th Floor","4Queens House"})
return(aNames)
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Wed Oct 22, 2008 5:01 pm

Marco,

Please modify this line this way:
Code: Select all  Expand view
... ACTION (aNames:=GetData1(), oBrw:SetArray(aNames), oBrw:aArrayData := aNames, oBrw:Refresh())
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Wed Oct 22, 2008 5:23 pm

Hi Antonio,
thanks for your quick reply,
unfortunately I have this situation in a lot of modules in my apps,
is there a way to apply this turn-around directly inside the xbrowse class at the Setarray method ?

Let me know. Thanks.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby demont frank » Wed Oct 22, 2008 6:14 pm

Marco,

In setarray is a check :
Code: Select all  Expand view
   if ::lCreated
      if ::nDataType == DATATYPE_ARRAY
         if SameArrayStruct( Self, aData )
            return nil // <=== !!!!!
         else
            ::aCols  := {}
            lReSet   := .t.
         endif
      else
         ::ClearBlocks()
         ::aCols  := {}
         lReset   := .t.
      endif
   endif


When the structure is the same , changing from array will not be executed , you have only to do oBrw:aArrayData := .....

I have at this moment serious problems (1 day testing ) after the last changes i sugested. I have one problem : working out a littlte self containging program needs more than that.

ANTONIO

Placing adjust in rowcount creates new problems , when oBrw:bClrstd is changed afterwards.

I have an aplication where in some cases the columns take not the value from oBrw:bClrstd . From what i can see i have something like :

XBROWSE ....

So , xbrowsenew is launched , in the new version adjust is executed , the columns receives default values from bClrStd

After this command is oBrw:bClrstd is changed in the program , in most cases without problems

Only , i am searching for a day , in some cases , column:bClrstd is not updated

XBROWSE is the favorite tool from many off us , it desearves more than defensive programming !

Frank[/code]
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Wed Oct 22, 2008 7:36 pm

Marco,

This change in Class TXBrowse could solve it, so there is no need to change your application source code:
Code: Select all  Expand view
   if ::lCreated
      if ::nDataType == DATATYPE_ARRAY
         if SameArrayStruct( Self, aData )
            ::aArrayData = aData
            return nil
         else
   ...



Frank,

If you review this year xbrowse changes in whatsnew.txt, you will see that we are doing a lot of R+D in xbrowse, so I don't see any defensive coding at all. It is complex code, still has some bugs, and we need to keep working on it, and we do appreciate your feedback.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Wed Oct 22, 2008 8:05 pm

Ok. Thanks all for the support.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby demont frank » Thu Oct 23, 2008 4:34 am

Antonio Linares wrote:Frank,

If you review this year xbrowse changes in whatsnew.txt, you will see that we are doing a lot of R+D in xbrowse, so I don't see any defensive coding at all. It is complex code, still has some bugs, and we need to keep working on it, and we do appreciate your feedback.


ANTONIO ,

I had problems with arrays (see previous threads) , your solution to solve this problems was

Code: Select all  Expand view
METHOD RowCount()     INLINE ( If( ::nRowHeight == nil, ::Adjust(),), Int( ( ::BrwHeight() - ::HeaderHeight() - ::FooterHeight() ) / ::nRowHeight ) )


Next code in refresh will execute this command (in some cases) :
Code: Select all  Expand view
      if nKeyNo >= ::nLen .and. ::nLen > 1
         ::nRowSel   := Min( nKeyNo, ::RowCount() )
      endif


Adjust is executed , and default values are given :

Code: Select all  Expand view
   DEFAULT ::bClrHeader   := ::oBrw:bClrHeader,;
           ::bClrFooter   := ::oBrw:bClrFooter,;
           ::bClrGrad     := ::oBrw:bClrGrad, ;
           ::bClrStd      := ::oBrw:bClrStd,;
           ::bClrSel      := ::oBrw:bClrSel,;
           ::bClrSelFocus := ::oBrw:bClrSelFocus ,;
           ::bClrEdit     := ::bClrStd
   ......


This code is executed from xbrowsenew , BUT mostly oBrw:bClr... are only set after this command.

Changing the method as described has maybe solved the problems reported a few days ago , but intruduced new ones. That is what i mean with defensif programming.

The problem rises when adjust is executed before the browse is created (on initialisizing) , but at that moment oBrw:nRowsel can only be 1 and must not be reset. Maybe a solution is :

Code: Select all  Expand view
      if nKeyNo >= ::nLen .and. ::nLen > 1 .and. ::lCreated
         ::nRowSel   := Min( nKeyNo, ::RowCount() )
      endif


But in that case there is maybe no need to change method rowcount()

Another solution could be to assign the default values in txbrwcolumn:adjust only when obrw:lCreated

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Thu Oct 23, 2008 8:53 am

Frank,

We appreciate your feedback. As I have explained you, its a complex code and still has bugs to solve.

With the users feedback and help we may be able to keep improving it. We take note of all reported bugs, etc. but if you don't get an inmediate response from us, please don't think that we are not listening to you.

There are many other FiveWin users that also require tech support and we have to help as many users as possible.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests