FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse and Array Refresh
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
xBrowse and Array Refresh
Posted: Mon Dec 15, 2008 12:48 PM
Dear Freinds,

In my app I am using a dialog with 2 xBrowse's on it.

xBrowse 1 (oBrwUsers) will display the user's list
xBrowse 2 (oBrwMenu) will display the Menu's available to the user

Wne the user moves thru the xBrowse 1, xBrowse 2 should update/refresh the menu's available to the user

In xBrowse 1 (oBrwUsers), I am using ADO RecordSet
In xBrowse 2 (oBrwMenu), I am using an array

Screen Snapshot



My problem is that xBrowse 2 is not getting refreshed when the user moves thru xBrowse 1

On xBrowse 1's bChange I have used the following code

oBrwUsers:bChange:={ || nUserId:=oUsers:oRecSet:Fields("User_Id"):Value,;
 // func GetUserMenu() will erase the array aMenu and creates a Fresh array, aMenu is the array used in xBrowse2						GetUserMenu(oUserMenu,oMenuArray,nUserId,@aMenu),; 
						oBrwMenu:Update(),;
						oBrwMenu:Refresh(),;
                   oDlg:UpDate() }


I have checked and found that Function GetUserMenu(oUserMenu,oMenuArray,nUserId,@aMenu) is creating the array perfectly with all the required data. But xBrowse not getting refreshed with the new updataed array data

Code to create xBrowse 2 (oBrwMenu)

@ 0,100 XBROWSE oBrwMenu ;
COLUMNS 2, 3 ;
HEADERS "Menu", "Status" ;
OF oDlg ;
ARRAY aMenu // should not use AUTOCOLS now

*oBrwMenu:SetArray( aMenu,.F. )
oBrwMenu:lUpdate := .t.
oBrwMenu:nColSel := 2
oBrwMenu:aCols[ 1 ]:=330
oBrwMenu:aCols[ 2 ]:SetCheck( { "CheckOn", "CheckOff" } )
oBrwMenu:aCols[ 2 ]:=NIL


Any Idea where I have went wrong ?

Regards

Anser
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
xBrowse and Array Refresh
Posted: Mon Dec 15, 2008 01:56 PM
function GetUserMenu(oUserMenu,oMenuArray,nUserId,aMenu) 
...
...
your commands
...
...

return aMenu

oBrwUsers:bChange:={ || nUserId:=oUsers:oRecSet:Fields("User_Id"):Value,;
                  oBrwMenu:aArrayData :=GetUserMenu(oUserMenu,oMenuArray,nUserId,aMenu),;
                  oBrwMenu:Refresh(),;
                   oDlg:UpDate() }


other point..
oBrwMenu:aCols[ 2 ]:={||NIL}
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
xBrowse and Array Refresh
Posted: Tue Dec 16, 2008 04:50 AM
Hi Daniel,

Thankyou for the support.

oBrwMenu:aArrayData did the trick

oBrwMenu:nWidth should be set manually for oBrwMenu:aCols[ 2 ]:={||NIL} to work properly otherwise it will give an error Len(0).

oBrwMenu:aCols[ 2 ]:nWidth:=100
oBrwMenu:aCols[ 2 ]:bStrData:={ || NIL }


Once again thank you for the help.

Regards

Anser

Continue the discussion