Disabling/removing menu
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
Disabling/removing menu
Hi Antonio,
I can't disable or remove menuitems... is it a FWPPC bug??
I post you a sample:
#include "FWCE.ch"
static oMenu1, oMenu2, oMenu
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
@0,0 button "Disable" size 100, 20 action oMenu1:Disable() pixel
@30,0 button "Remove" size 100, 20 action RemoveMenu(oMenu:hMenu, 1) pixel
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oMenu1 ID 110 OF oMenu ACTION MsgInfo( "First" ) when .F.
REDEFINE MENUITEM oMenu2 ID 120 OF oMenu ACTION MsgInfo( "Second" )
return oMenu
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include "windows.h"
HB_FUNC(REMOVEMENU) {
RemoveMenu((HMENU) hb_parnl(1), (UINT) hb_parnl(2), MF_BYPOSITION);
}
#pragma ENDDUMP
Regards,
Roberto Parisi
I can't disable or remove menuitems... is it a FWPPC bug??
I post you a sample:
#include "FWCE.ch"
static oMenu1, oMenu2, oMenu
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
@0,0 button "Disable" size 100, 20 action oMenu1:Disable() pixel
@30,0 button "Remove" size 100, 20 action RemoveMenu(oMenu:hMenu, 1) pixel
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oMenu1 ID 110 OF oMenu ACTION MsgInfo( "First" ) when .F.
REDEFINE MENUITEM oMenu2 ID 120 OF oMenu ACTION MsgInfo( "Second" )
return oMenu
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include "windows.h"
HB_FUNC(REMOVEMENU) {
RemoveMenu((HMENU) hb_parnl(1), (UINT) hb_parnl(2), MF_BYPOSITION);
}
#pragma ENDDUMP
Regards,
Roberto Parisi
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Roberto,
Please try these functions:
Please try these functions:
Code: Select all
TB_ENABLE( oMenu:hMenu, oMenuItem:nId )
TB_DISABLE( oMenu:hMenu, oMenuItem:nId )
Code: Select all
HB_FUNC( TB_DISABLE )
{
HWND hMenuBar = (HWND)SHFindMenuBar(hb_parnl(1));
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_INDETERMINATE;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi );
return;
}
HB_FUNC ( TB_ENABLE )
{
HWND hMenuBar = ( HWND ) SHFindMenuBar( hb_parnl( 1 ) );
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_ENABLED;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi);
return;
}
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
Thx Antonio but it seems doesn't work:
This is the full sample code:
#include "FWCE.ch"
static oMenuItem1, oMenuItem2, oMenu
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
@0,0 button "Disable" size 100, 20 action TB_Disable(oMenu:hMenu, oMenuItem1:nID) pixel
@30,0 button "Remove" size 100, 20 action TB_Enable(oMenu:hMenu, oMenuItem1:nID) pixel
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oMenuItem1 ID 110 OF oMenu ACTION MsgInfo( "First" ) when .F.
REDEFINE MENUITEM oMenuItem2 ID 120 OF oMenu ACTION MsgInfo( "Second" )
return oMenu
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include "windows.h"
#include "commctrl.h"
HB_FUNC( TB_DISABLE )
{
HWND hMenuBar = (HWND)SHFindMenuBar(hb_parnl(1));
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_INDETERMINATE;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi );
return;
}
HB_FUNC ( TB_ENABLE )
{
HWND hMenuBar = ( HWND ) SHFindMenuBar( hb_parnl( 1 ) );
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_ENABLED;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi);
return;
}
#pragma ENDDUMP
Regards,
Roberto Parisi
This is the full sample code:
#include "FWCE.ch"
static oMenuItem1, oMenuItem2, oMenu
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
@0,0 button "Disable" size 100, 20 action TB_Disable(oMenu:hMenu, oMenuItem1:nID) pixel
@30,0 button "Remove" size 100, 20 action TB_Enable(oMenu:hMenu, oMenuItem1:nID) pixel
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oMenuItem1 ID 110 OF oMenu ACTION MsgInfo( "First" ) when .F.
REDEFINE MENUITEM oMenuItem2 ID 120 OF oMenu ACTION MsgInfo( "Second" )
return oMenu
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include "windows.h"
#include "commctrl.h"
HB_FUNC( TB_DISABLE )
{
HWND hMenuBar = (HWND)SHFindMenuBar(hb_parnl(1));
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_INDETERMINATE;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi );
return;
}
HB_FUNC ( TB_ENABLE )
{
HWND hMenuBar = ( HWND ) SHFindMenuBar( hb_parnl( 1 ) );
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_STATE;
tbbi.fsState = TBSTATE_ENABLED;
SendMessage( hMenuBar, TB_SETBUTTONINFO, hb_parnl( 2 ), ( LPARAM ) &tbbi);
return;
}
#pragma ENDDUMP
Regards,
Roberto Parisi
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Roberto,
This sample is working fine. No need for the functions that I told you, sorry:
This sample is working fine. No need for the functions that I told you, sorry:
Code: Select all
#include "FWCE.ch"
static oMenuItem1, oMenuItem2, oMenu
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
@ 0, 0 button "Disable" size 100, 20 action oMenuItem1:Disable() pixel
@ 30, 0 button "Enable" size 100, 20 action oMenuItem1:Enable() pixel
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oMenuItem1 ID 110 OF oMenu ACTION MsgInfo( "First" )
REDEFINE MENUITEM oMenuItem2 ID 120 OF oMenu ACTION MsgInfo( "Second" )
return oMenu
//----------------------------------------------------------------------------//
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Roberto,
You must be doing something wrong as here it is working fine.
Please download it and test it:
http://rapidshare.com/files/87217677/test.zip.html
You must be doing something wrong as here it is working fine.
Please download it and test it:
http://rapidshare.com/files/87217677/test.zip.html
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
Ok Antonio, I understand.
I use another rc file (the same of your testmenu.prg sample) without child menuitems.
This is the rc file:
#ifdef _CE
#include "c:\vce\include\arm\windows.h"
#include "c:\vce\include\arm\commctrl.h"
#endif
#define I_IMAGENONE (-2)
#define IDS_HELP 104
#ifdef _CE
102 RCDATA
BEGIN
102, 2,
I_IMAGENONE, 110, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 202, 0, 0,
I_IMAGENONE, 120, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 203, 0, 0,
END
#endif
STRINGTABLE DISCARDABLE
BEGIN
202 "First"
203 "Second"
END
102 MENU DISCARDABLE
BEGIN
MENUITEM "", 110
MENUITEM "", 120
END
Regards,
Roberto Parisi
I use another rc file (the same of your testmenu.prg sample) without child menuitems.
This is the rc file:
#ifdef _CE
#include "c:\vce\include\arm\windows.h"
#include "c:\vce\include\arm\commctrl.h"
#endif
#define I_IMAGENONE (-2)
#define IDS_HELP 104
#ifdef _CE
102 RCDATA
BEGIN
102, 2,
I_IMAGENONE, 110, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 202, 0, 0,
I_IMAGENONE, 120, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 203, 0, 0,
END
#endif
STRINGTABLE DISCARDABLE
BEGIN
202 "First"
203 "Second"
END
102 MENU DISCARDABLE
BEGIN
MENUITEM "", 110
MENUITEM "", 120
END
Regards,
Roberto Parisi
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 116
- Joined: Thu Oct 13, 2005 5:14 pm
- Location: Italy
Every value...
With the sample try to press SHIFT + TAB to go to previous control... it goes always to the next control forward.
Regards,
Roberto Parisi
#include "FWCE.ch"
function Main()
local oWnd, cText := Space( 50 ), cText1 := Space( 50 ), cText2 := Space( 50 )
DEFINE WINDOW oWnd TITLE "Test"
@ 0, 0 GET cText SIZE 200, 20 pixel
@ 30, 2 GET cText1 SIZE 200, 20 pixel
@ 60, 2 GET cText2 SIZE 200, 20 pixel
ACTIVATE WINDOW oWnd
return nil
With the sample try to press SHIFT + TAB to go to previous control... it goes always to the next control forward.
Regards,
Roberto Parisi
#include "FWCE.ch"
function Main()
local oWnd, cText := Space( 50 ), cText1 := Space( 50 ), cText2 := Space( 50 )
DEFINE WINDOW oWnd TITLE "Test"
@ 0, 0 GET cText SIZE 200, 20 pixel
@ 30, 2 GET cText1 SIZE 200, 20 pixel
@ 60, 2 GET cText2 SIZE 200, 20 pixel
ACTIVATE WINDOW oWnd
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: