xBrowse and Array Refresh

xBrowse and Array Refresh

Postby anserkk » 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
Image
Image

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

Code: Select all  Expand view
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 ]:nWidth:=330
oBrwMenu:aCols[ 2 ]:SetCheck( { "CheckOn", "CheckOff" } )
oBrwMenu:aCols[ 2 ]:bStrData:=NIL


Any Idea where I have went wrong ?

Regards

Anser
User avatar
anserkk
 
Posts: 1330
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby Daniel Garcia-Gil » Mon Dec 15, 2008 1:56 pm

Code: Select all  Expand view
function GetUserMenu(oUserMenu,oMenuArray,nUserId,aMenu)
...
...
your commands
...
...

return aMenu

Code: Select all  Expand view
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 ]:bStrData:={||NIL}
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby anserkk » Tue Dec 16, 2008 4:50 am

Hi Daniel,

Thankyou for the support.

oBrwMenu:aArrayData did the trick

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

Code: Select all  Expand view
oBrwMenu:aCols[ 2 ]:nWidth:=100
oBrwMenu:aCols[ 2 ]:bStrData:={ || NIL }


Once again thank you for the help.

Regards

Anser
User avatar
anserkk
 
Posts: 1330
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 10 guests