//--- Sets focus to child MDI window with cTitle
static function wndSetFocus(cTitle)
local i:=0,lSuccess:=.f.
cTitle:=upper(cTitle)
for i=1 to len(wndMain():oWndClient:aWnd)
if upper( wndMain():oWndClient:aWnd[i]:cCaption )=cTitle
wndMain():oWndClient:aWnd[i]:setFocus()
lSuccess:=.t.
endif
next
return lSuccess
#define DISABLE_CALLINGITEM
// above define is used when we want to disable
// invoking button or menuitem
function MyMDIChild( oItem ) // oItem is required if we want to disalbe the invoking menuitem / button
static lRunning := .f.
local oWnd
local lMenuDisabled := .f.
if lRunning
if oWnd != nil
if isIconic( oWnd:hWnd )
WndMain():oWndClient:ChildRestore( oWnd )
endif
WndMain():oWndClient:ChildActivate( oWnd )
endif
return nil
endif
lRunning := .t.
#ifdef DISABLE_CALLINGITEM
if Valtype( oItem ) == "O" .and. ;
Upper( oItem:ClassName ) $ "TBTNBMP,TMENUITEM"
oItem:Disable()
lMenuDisabled := .t.
endif
#endif
// other code
DEFINE WINDOW oWnd MDICHILD OF oWnd
// other code
ACTIVATE WINDOW oWnd ;
VALID ( If( lMenuDisabled, oItem:Enable(), ), lRunning := .f., .t. )
return nil
//----------------------------------------------------------------------------//
// To avail the functionality to disable/enable
// the calling buttons ( if that is what we want )
// menu / buttonbar buttons should be coded like this
MENUITEM "MyMdiChild" ACTION MyMdiChild( oMenuItem )
DEFINE BUTTON OF oBar ACTION MyMdiChild( This )
//----------------------------------------------------------------------------//
James Bott wrote:Uwe,
I do that by building the menus and buttons based on the user rights after the user has logged in. Is that what you are doing?
James
if oUser:level >= 3
meunu item ...
endif
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 80 guests