wxCodeGen (tool bars)
BlitzMax Forums/Brucey's Modules/wxCodeGen (tool bars)
| ||
Toolbar code doesn't seem to compile as the wxFormBuilder generates a member variable for the tool:<object class="wxToolBar" name="m_toolBar1"> <style>wxTB_HORIZONTAL</style> <bitmapsize></bitmapsize> <margins></margins> <packing>1</packing> <separation>5</separation> <object class="tool" name="m_boxTool"> <label>Box Tool</label> <tooltip></tooltip> <longhelp></longhelp> <bitmap>data/images/editor/build_box.bmp</bitmap> </object> </object> Like above the member var 'm_boxTool' currently gets generated in blitzmax as follows:
m_toolBar1.AddTool(TOOL_BOXTOOL, "Box Tool", wxBitmap.CreateFromFile("data/images/editor/build_box.bmp", wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, "", "")
m_toolBar1.AddTool(m_boxTool)
the problem is that m_boxTool is never created as a 'field' inside the base wxFrame class. Things I've tried: - giving the tool item a blank name but this resulted in this: m_toolBar.AddControl() I've worked around this currently by editing code_gen.bmx from this:
For Local child:TFBWidget = EachIn kids
child.Generate(out)
If Not TFBToolSeparator(child) Then
out.Add(prop("name") + ".AddControl(" + child.prop("name") + ")", 2)
End If
Next
to this:
For Local child:TFBWidget = EachIn kids
child.Generate(out)
If Not TFBToolSeparator(child) Then
If child.prop("name") <> "" Then
out.Add(prop("name") + ".AddControl(" + child.prop("name") + ")", 2)
End If
End If
Next
I'm new to wxMax and wxWidgets in general so I may be going about tool bars in the wrong way, but I didnt' see a need to add a control after adding the tool and connecting the correct id the correct events. Am I missing something here? |
| ||
| Yep, the second line of AddControl() shouldn't be there for tool items. I've updated SVN with a fix. Which is essentially this: If Not TFBToolSeparator(child) And Not TFBToolItem(child) Then Apologies for the bug, and thanks for looking into it :-) |
| ||
| Glad it's fixed in the SVN :D, thanks for the quick turn around! |