2001-09-04 08:41 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

* contrib/hgf/os2pm/*
     ! fixed menu items handling under OS/2 where you cannot change a MIS_TEXT into
       a MIS_SUBMENU without first deleting MIS_TEXT and then inserting MIS_SUBMENU
This commit is contained in:
Maurilio Longo
2001-09-04 06:44:26 +00:00
parent 7693e43d3b
commit acc8e68bed
6 changed files with 61 additions and 22 deletions

View File

@@ -1,7 +1,12 @@
2001-09-04 08:41 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
* contrib/hgf/os2pm/*
! fixed menu items handling under OS/2 where you cannot change a MIS_TEXT into
a MIS_SUBMENU without first deleting MIS_TEXT and then inserting MIS_SUBMENU
2001-09-03 17:19 GMT Dave Pearson <davep@davep.org>
* source/rtl/Makefile
* Added persist.org to PRG_SOURCES.
2001-09-03 16:56 GMT Dave Pearson <davep@davep.org>
* source/rtl/isprint.c
* Added missing comment close.

View File

@@ -226,6 +226,30 @@ HB_FUNC( WINADDMENUITEM )
}
// Given an id of a menuitem changes it to a MIS_SUBMENU type of menu item
// NOTE: You have to delete and reinsert a menu item if you want to change it from
// a MIS_TEXT to a MIS_SUBMENU type of menuitem
HB_FUNC( WINMAKESUBMENUITEM )
{
MENUITEM mit;
MRESULT rc;
char text[100];
rc = WinSendMsg((HWND) hb_parnl(1), MM_QUERYITEM, MPFROM2SHORT(hb_parni(2), FALSE ), &mit );
if ((BOOL)rc) {
WinSendMsg((HWND) hb_parnl(1), MM_QUERYITEMTEXT, MPFROM2SHORT(hb_parni(2), 100), &text );
WinSendMsg((HWND) hb_parnl(1), MM_DELETEITEM, MPFROM2SHORT(hb_parni(2), FALSE ), 0L );
mit.hwndSubMenu = hb_parnl(3);
mit.afStyle |= MIS_SUBMENU;
// re-insert the menuitem
WinSendMsg((HWND) hb_parnl(1), MM_INSERTITEM, &mit, &text);
}
hb_retnl(0);
}
HB_FUNC( WINSETPARENT )
{
hb_retl( WinSetParent( ( HWND ) hb_parnl( 1 ), ( HWND ) hb_parnl( 2 ),

View File

@@ -78,7 +78,6 @@ CLASS TForm
ASSIGN nWidth( nNewWidth ) INLINE ;
WinSetWidth( ::hWnd, nNewWidth )
ENDCLASS
@@ -122,7 +121,7 @@ return nil
ASSIGN oMenu( oNewMenu ) CLASS TForm
::oMainMenu = oNewMenu
::oMainMenu := oNewMenu
WinSetParent( oNewMenu:nHandle, ::hWnd, .t. )
WinSetOwner( oNewMenu:nHandle, ::hWnd )

View File

@@ -59,19 +59,21 @@
CLASS TMenu
DATA nHandle // Handle of this SUBMENU (be it top level or drop down)
DATA nHandle // Handle of MIS_ACTIONBAR
DATA aItems // Items inside this menu
DATA oParent // Parent/Owner of menu
METHOD New( oForm )
METHOD Add( oMenuItem )
METHOD New(oForm)
METHOD Add(oMenuItem)
ENDCLASS
METHOD New( oForm ) CLASS TMenu
::aItems = {}
::nHandle = WinCreateMenu( oForm:hWnd )
::aItems := {}
::oParent := oForm
::nHandle := WinCreateMenu( oForm:hWnd )
return Self
@@ -79,7 +81,7 @@ return Self
METHOD Add( oMenuItem ) CLASS TMenu
WinAddMenuItem( ::nHandle, oMenuItem:cCaption, MIT_END,;
oMenuItem:nHandle, oMenuItem:nId, oMenuItem:lEnabled )
nil, oMenuItem:nId, oMenuItem:lEnabled )
AAdd( ::aItems, oMenuItem )

View File

@@ -60,19 +60,19 @@
CLASS TMenuItem
DATA cCaption // Specifies the text of the menu item
DATA OnClick // A character description of the method to invoke
DATA nId // Command value to send to the container form
DATA lEnabled // Specifies whether the menu item is enabled
DATA cCaption // Specifies the text of the menu item
DATA OnClick // A character description of the method to invoke
DATA nId // Command value to send to the container form
DATA lEnabled // Specifies whether the menu item is enabled
DATA aItems // Contains the menu items in the submenu of the menu item
DATA oParent // Identifies the parent menu item of this menu item
DATA nHandle // The handle of _this_ menu item
DATA aItems // Contains the menu items in the submenu of the menu item
DATA oParent // Identifies the parent menu item of this menu item
DATA nHandle // The handle of submenu window (if there is any)
CLASSDATA nIdStart // start value for commands value to assign to menu items
CLASSDATA nIdStart // start value for commands value to assign to menu items
METHOD New( oOwner ) // Creates a new menu item
METHOD Add( oMenuItem ) // Adds a new drop down menu item
METHOD New( oOwner ) // Creates a new menu item
METHOD Add( oMenuItem ) // Adds a new drop down menu item
ENDCLASS
@@ -85,15 +85,21 @@ METHOD New( oOwner ) CLASS TMenuItem
::nId = ::nIdStart++
::lEnabled = .t.
::oParent = oOwner
::nHandle := WinCreateMenu( ::oParent:nHandle )
::aItems := {}
return Self
METHOD Add( oMenuItem ) CLASS TMenuItem
WinAddMenuItem( ::nHandle, oMenuItem:cCaption, MIT_END,;
DEFAULT ::aItems TO {}
if ::nHandle == nil
::nHandle := WinCreateMenu( ::oParent:nHandle )
WinMakeSubMenuItem(::oParent:nHandle, ::nId, ::nHandle)
endif
WinAddMenuItem(::nHandle, oMenuItem:cCaption, MIT_END,;
nil, oMenuItem:nId, oMenuItem:lEnabled )
AAdd( ::aItems, oMenuItem )
@@ -102,3 +108,5 @@ return nil

View File

@@ -80,3 +80,4 @@ char ** __crt0_glob_function( char * _arg )
return 0;
}
#endif