xBrowse and Array Refresh

Post Reply
User avatar
anserkk
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India
Has thanked: 2 times

xBrowse and Array Refresh

Post by anserkk »

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

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
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Post by Daniel Garcia-Gil »

Code: Select all | Expand

function GetUserMenu(oUserMenu,oMenuArray,nUserId,aMenu) 
...
...
your commands
...
...

return aMenu

Code: Select all | Expand

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}
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
anserkk
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India
Has thanked: 2 times

Post by anserkk »

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

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


Once again thank you for the help.

Regards

Anser
Post Reply