2011-05-09 00:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbxbp/xbpmenubar.prg
  * contrib/hbxbp/xbpparthandler.prg
    ! Corrected: many artifacts related to XbpMenu() and 
      :setOwner()/:setParent() functionality. Thanks Shum for insight.
This commit is contained in:
Pritpal Bedi
2011-05-09 07:23:06 +00:00
parent cf18c3f876
commit 6caec86f06
3 changed files with 38 additions and 11 deletions

View File

@@ -16,6 +16,12 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-05-09 00:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbpparthandler.prg
! Corrected: many artifacts related to XbpMenu() and
:setOwner()/:setParent() functionality. Thanks Shum for insight.
2011-05-07 13:18 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbpmenubar.prg
! Fixed: where XbpMenu() activation was not supplying the documented

View File

@@ -114,7 +114,7 @@ CLASS xbpMenuBar INHERIT xbpWindow
DATA caption INIT ""
DATA nItemID INIT 0
DATA aIds INIT {}
DATA className INIT "XbpMenuBar"
DATA className INIT "XBPMENUBAR"
METHOD init( oParent, aPresParams, lVisible )
METHOD create( oParent, aPresParams, lVisible )
@@ -245,9 +245,9 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
DO CASE
CASE cType == "U" .OR. empty( xCaption ) .OR. nStyle == XBPMENUBAR_MIS_SEPARATOR
IF lInsert
oAction := ::oWidget:insertSeparator()
oAction := ::oWidget:insertSeparator( pOldAct )
ELSE
::oWidget:addSeparator()
oAction := ::oWidget:addSeparator()
ENDIF
aItem := { QMF_SEPARATOR, 0, 0, NIL, oAction }
@@ -370,7 +370,7 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
METHOD xbpMenuBar:addItem( aItem )
LOCAL xCaption, bAction, nStyle, nAttrib
IF PCount() == 1 .and. valtype( aItem ) == "A"
IF PCount() == 1 .AND. hb_isArray( aItem )
ASize( aItem, 4 )
xCaption := aItem[ 1 ]
@@ -645,6 +645,7 @@ METHOD xbpMenuBar:setStyle()
CLASS xbpMenu INHERIT xbpMenuBar
DATA title INIT ""
DATA className INIT "XBPMENU"
METHOD init( oParent, aPresParams, lVisible )
METHOD create( oParent, aPresParams, lVisible )
@@ -652,6 +653,7 @@ CLASS xbpMenu INHERIT xbpMenuBar
METHOD setTitle( cTitle )
METHOD popUp( oXbp, aPos, nDefaultItem, nControl )
METHOD setStyle()
METHOD normalize( cCaption )
ENDCLASS
@@ -670,6 +672,7 @@ METHOD xbpMenu:create( oParent, aPresParams, lVisible )
::xbpWindow:create( oParent, , , , aPresParams, lVisible )
::oWidget := QMenu()
::oWidget:setTitle( ::normalize( ::title ) )
IF hb_isObject( ::oParent )
::oParent:oWidget:addMenu( ::oWidget )
@@ -689,8 +692,12 @@ METHOD xbpMenu:getTitle()
/*----------------------------------------------------------------------*/
METHOD xbpMenu:setTitle( cTitle )
LOCAL oldTitle := ::title
RETURN ::title := cTitle
::title := cTitle
::oWidget:setTitle( ::normalize( ::title ) )
RETURN oldTitle
/*----------------------------------------------------------------------*/
@@ -708,6 +715,12 @@ METHOD xbpMenu:popUp( oXbp, aPos, nDefaultItem, nControl )
/*----------------------------------------------------------------------*/
METHOD xbpMenu:normalize( cCaption )
RETURN strtran( cCaption, '~', '&' )
/*----------------------------------------------------------------------*/
METHOD xbpMenu:setStyle()
LOCAL s, txt_:={}

View File

@@ -128,12 +128,13 @@ METHOD XbpPartHandler:create( oParent, oOwner )
::oParent := oParent
::oOwner := oOwner
// DEFAULT ::oOwner TO ::oParent
IF hb_isObject( ::oOwner )
::oOwner:addAsOwned( Self )
ENDIF
DEFAULT ::oParent TO SetAppWindow()
DEFAULT ::oOwner TO ::oParent
RETURN Self
/*----------------------------------------------------------------------*/
@@ -217,11 +218,18 @@ METHOD XbpPartHandler:addAsOwned( oXbp )
/*----------------------------------------------------------------------*/
METHOD XbpPartHandler:childFromName( nNameId )
LOCAL i
LOCAL oXbp, oXbpC
FOR i := 1 TO len( ::aChildren )
IF ::aChildren[ i ]:nNameID <> NIL .AND. ::aChildren[ i ]:nNameID == nNameID
RETURN ::aChildren[ i ]
FOR EACH oXbp IN ::aChildren
IF oXbp:nNameID <> NIL .AND. oXbp:nNameID == nNameID
RETURN oXbp
ELSE
FOR EACH oXbpC IN oXbp:aChildren
IF oXbpC:nNameID <> NIL .AND. oXbpC:nNameID == nNameID
RETURN oXbpC
ENDIF
NEXT
ENDIF
NEXT