List Info

Thread: DB 3.03 Menu code generation bug




DB 3.03 Menu code generation bug
user name
2006-06-26 22:57:12

Hi,

I have found a bug with the DB generated code when you have a menu with
the "Enabled" checkbox being unchecked. Im using DB 3.03 for Windows.
The steps to reproduce it are:

1. Create new DB project and add a menu with some menu items. Compile
and see that everything works fine.
2. In DB, go to the "Enabled" checkbox for the Menu, and uncheck it.
3. Now you wont be able to compile because DB will have generated some
uncompilable code.

The code snippet in question is:

////begin MenuTestFrame content construction
MenuTestFrame* itemFrame1 = this;

wxMenuBar* menuBar = new wxMenuBar;
wxMenu* itemMenu3 = new wxMenu;
itemMenu3->Append(ID_MENUITEM, _("Item"), _T(""), wxITEM_NORMAL);
menuBar->Append(itemMenu3, _("Menu"));
menuBar->Enable(itemMenu3, false); // This is the line which wont
compile.
itemFrame1->SetMenuBar(menuBar);

////end MenuTestFrame content construction

But the compiler complains because the first argument to Enable is int
not wxMenu*.

Craig.

__._,_.___
.

__,_._,___
DB 3.03 Menu code generation bug
user name
2006-06-26 23:10:58

Well, according to the documentation for wxWidgets 2.6.3 the code on the line you've commented is correct.  The documentation is:
 
wxMenu::Enable
void Enable(int id, const bool enable)
Enables or disables (greys out) a menu item.
Parameters
id
The menu item identifier.
enable
true to enable the menu item, false to disable it.
See also
 
wxMenuBar::Enable
void Enable(int id, const bool enable)
Enables or disables (greys out) a menu item.
Parameters
id
The menu item identifier.
enable
true to enable the item, false to disable it.
Remarks
Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.
 
So, the problem must be elsewhere.
 
fyi,
Dave S.
 
Thought for the Day:
 
The fault is not in trying and not succeeding.
The fault is in not trying!

**********************************
From: Craig Kadziolka on Tue, 27 Jun 2006 10:57:12 +1200
**********************************
> Hi,
>
> I have found a bug with the DB generated code when you have a menu
> with the "Enabled" checkbox being unchecked. Im using DB 3.03 for
> Windows. The steps to reproduce it are:
>
> 1. Create new DB project and add a menu with some menu items.
> Compile and see that everything works fine.
> 2. In DB, go to the "Enabled" checkbox for the Menu, and uncheck
> it. 3. Now you wont be able to compile because DB will have
> generated some uncompilable code.
>
> The code snippet in question is:
>
> ////begin MenuTestFrame content construction
> MenuTestFrame* itemFrame1 = this;
>
> wxMenuBar* menuBar = new wxMenuBar;
> wxMenu* itemMenu3 = new wxMenu;
> itemMenu3->Append(ID_MENUITEM, _("Item"), _T(""), wxITEM_NORMAL);
> menuBar->Append(itemMenu3, _("Menu"));
> menuBar->Enable(itemMenu3, false); // This is the line which wont
> compile. itemFrame1->SetMenuBar(menuBar);
>
> ////end MenuTestFrame content construction
>
> But the compiler complains because the first argument to Enable is
> int not wxMenu*.
>
> Craig.
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~--> Great things are happening at Yahoo! Groups.  See the new
> email design.
> ---------------------------------------------------------~->
>
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
>
> <*> To unsubscribe from this group, send an email to: anthemion-
> devtools-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:

__._,_.___
.

__,_._,___
DB 3.03 Menu code generation bug
user name
2006-06-26 23:20:07

Hi,

I dont think the line I have commented is correct at all. Lets take a look at it again, remembering that it is autogenerated code:

Firstly we have:

> wxMenu* itemMenu3 = new wxMenu;

Which I think we can both agree, isn't an "int" at all. Then DB auto-generates:

> menuBar->Enable(itemMenu3, false);

Which doesn't compile. Looking at the documentation which you have provided (thanks), we can see that Enable takes an "int", not a "wxMenu*".

Another point, this used to work on the 2.xx version of DB that I was using prior to upgrading to 3.03 a few days ago.

Hope this clarifies.

Craig.


Dave Silvia wrote:
blunt" type="cite">
Well, according to the documentation for wxWidgets 2.6.3 the code on the line you've commented is correct.  The documentation is:
 
wxMenu::Enable
void Enable(int id, const bool enable)
Enables or disables (greys out) a menu item.
Parameters
id
The menu item identifier.
enable
true to enable the menu item, false to disable it.
See also
 
wxMenuBar::Enable
void Enable(int id, const bool enable)
Enables or disables (greys out) a menu item.
Parameters
id
The menu item identifier.
enable
true to enable the item, false to disable it.
Remarks
Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.
 
So, the problem must be elsewhere.
 
fyi,
Dave S.
 
Thought for the Day:
 
The fault is not in trying and not succeeding.
The fault is in not trying!

**********************************
From: Craig Kadziolka on Tue, 27 Jun 2006 10:57:12 +1200
**********************************
> Hi,
>
> I have found a bug with the DB generated code when you have a menu
> with the "Enabled" checkbox being unchecked. Im using DB 3.03 for
> Windows. The steps to reproduce it are:
>
> 1. Create new DB project and add a menu with some menu items.
> Compile and see that everything works fine.
> 2. In DB, go to the "Enabled" checkbox for the Menu, and uncheck
> it. 3. Now you wont be able to compile because DB will have
> generated some uncompilable code.
>
> The code snippet in question is:
>
> ////begin MenuTestFrame content construction
> MenuTestFrame* itemFrame1 = this;
>
> wxMenuBar* menuBar = new wxMenuBar;
> wxMenu* itemMenu3 = new wxMenu;
> itemMenu3->Append(ID_MENUITEM, _("Item"), _T(""), wxITEM_NORMAL);
> menuBar->Append(itemMenu3, _("Menu"));
> menuBar->Enable(itemMenu3, false); // This is the line which wont
> compile. itemFrame1-&gt;SetMenuBar(menuBar);
>
> ////end MenuTestFrame content construction
>
> But the compiler complains because the first argument to Enable is
> int not wxMenu*.
>


__._,_.___
.

__,_._,___
DB 3.03 Menu code generation bug
user name
2006-06-27 06:21:40

Thanks, I'll fix that in the next release.

Regards,

Julian

At 23:57 26/06/2006, you wrote:
&gt;Hi,
>
>I have found a bug with the DB generated code when you have a menu with
>the "Enabled" checkbox being unchecked. Im using DB 3.03 for Windows.
>The steps to reproduce it are:
>
>1. Create new DB project and add a menu with some menu items. Compile
&gt;and see that everything works fine.
>;2. In DB, go to the "Enabled" checkbox for the Menu, and uncheck it.
>3. Now you wont be able to compile because DB will have generated some
>uncompilable code.
>;
>The code snippet in question is:
>
>////begin MenuTestFrame content construction
> MenuTestFrame* itemFrame1 = this;
>;
> wxMenuBar* menuBar = new wxMenuBar;
> wxMenu* itemMenu3 = new wxMenu;
&gt; itemMenu3->Append(ID_MENUITEM, _("Item"), _T("&quot;), wxITEM_NORMAL);
>; menuBar-&gt;Append(itemMenu3, _("Menu"));
> menuBar-&gt;Enable(itemMenu3, false); // This is the line which wont
>compile.
&gt; itemFrame1->SetMenuBar(menuBar);
>
>////end MenuTestFrame content construction
>
&gt;But the compiler complains because the first argument to Enable is int
>not wxMenu*.
>
>Craig.
>
>
>;
>
&gt;
>Yahoo! Groups Links
>;
>
&gt;
>

==============================================================================
Julian Smart juliananthemion.co.uk
28/5 Gillespie Crescent, Edinburgh, http://www.anthemion.co.uk
Midlothian, U.K., EH10 4HU +44 (0)131 229 5306
Writer's Cafe: power tools for writers http://www.writerscafe.co.uk
HelpBlocks: HTML help authoring http://www.helpblocks.com
DialogBlocks: cross-platform dialogs http://www.anthemion.co.uk/dialogblocks
==============================================================================

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )