1. wxEuphoria - Menu Font
- Posted by EUWX Mar 11, 2012
- 1450 views
I modified Menu-demo.exw program creating new fonts. The new fonts work well in another of the demo programs.
#!/home/matt/euphoria/bin/exu -- example8.exw -- -- This example places a menu in a window without warning include wxeu/wxeud.e object void global integer -- Courier new 9 point euCNNorm9 = create( wxFont, {9,wxDEFAULT,wxNORMAL,wxNORMAL,0,"Courier New"}), -- more here Bold, Italics, Underlined etc -- Courier new 10 point euCNNorm10 = create( wxFont, {10,wxDEFAULT,wxNORMAL,wxNORMAL,0,"Courier New"}), -- more here Bold, Italics, Underlined etc -- Times New Roman 9 point euTNRNorm9 = create( wxFont, {9,wxROMAN,wxNORMAL,wxNORMAL,0,"Times New Roman"}), -- more here Bold, Italics, Underlined etc -- Times New Roman 10 point euTNRNorm10 = create( wxFont, {10,wxROMAN,wxNORMAL,wxNORMAL,0,"Times New Roman"}), -- more here Bold, Italics, Underlined etc -- Times New Roman 12 point euTNRNorm12 = create( wxFont, {12,wxROMAN,wxNORMAL,wxNORMAL,0,"Times New Roman"}), euTNRItal12 = create( wxFont, {12,wxROMAN,wxITALIC,wxNORMAL,0,"Times New Roman"}), -- more here Bold, Underlined etc -- Arial 10 point euARNorm10 = create( wxFont, {10,wxDEFAULT,wxNORMAL,wxNORMAL,0,"Arial"}), euARBold10 = create( wxFont, {10,wxDEFAULT,wxNORMAL,wxBOLD,0,"Arial"}), $ constant MenuWin = create( wxFrame,{0,-1, "Menus"} ), win = create( wxPanel, {MenuWin}) constant MenuBar = create( wxMenuBar, {MenuWin}), FileMenu = create( wxMenu, {MenuBar,"&File"}), MenuNew = create( wxMenuItem,{ FileMenu, wxID_NEW,"&New\tCtrl+N"}), MenuOpen = create( wxMenuItem,{ FileMenu, wxID_OPEN, "&Open"}), MenuSave = create( wxMenuItem,{ FileMenu, wxID_SAVE, "&Save"}), MenuSaveAs = create( wxMenuItem,{ FileMenu, wxID_SAVEAS, "Save &As"}) append_separator( FileMenu ) -- etc etc -- etc etc
I added :
set_default_font ( win, euARBold10) set_default_font (MenuWin, euTNRItal12)
I put one or both of these lines separately or together in various places to see if the font will change on execution, but the font remains the same. I also tried and failed with using MenuBar instead of win or MenuWin
-- set_default_font (MenuBar, euTNRItal12)
I also was not able to use later
set_menu_label ( MenuBar, FileMenu, "MyFileMenu")
I am new to Euphoria and wxEuphoria. I shall appreciate help or direction to a working wxEuphoria program where the Font in the Menu can be changes dynamically, and the text of the labels can also be changed dynamically or redrawn or something like that.
2. Re: wxEuphoria - Menu Font
- Posted by mattlewis (admin) Mar 11, 2012
- 1443 views
I am new to Euphoria and wxEuphoria. I shall appreciate help or direction to a working wxEuphoria program where the Font in the Menu can be changes dynamically, and the text of the labels can also be changed dynamically or redrawn or something like that.
I don't think this is possible. The menus are native widgets, and so the fonts are determined by your OS or window manager settings.
Matt
3. Re: wxEuphoria - Menu Font
- Posted by ghaberek (admin) Mar 11, 2012
- 1457 views
It looks like one can do this in wxWidgets 2.9 (that's all I checked) by simply calling SetFont() on the wxMenuItem object (but not wxMenu or wxMenuBar). If it's that simple then we'd just have to wrap it in the code (set_menuitem_font() perhaps?). Maybe we can even add it as a option in create().
-Greg
4. Re: wxEuphoria - Menu Font
- Posted by EUWX Mar 11, 2012
- 1380 views
The example above looks very good but i am not able to get it working
I tried various ways of Set_Font, set_font, setfont, etc on several of the menuitems created. the only syntax accepted is the one with lowercase only and an underscore.
set_font(MenuNew,euTNRItal12) set_font(MenuSave,euTNRItal12) set_font(MenuCopy,euTNRItal12)
However, on execution it does NOT change the font of those MenuItems.
I am using Windows XP and wxEuphoria version 16 on top or Euophoria 4.0.3
I think the version of wxWidgets is 2.8.12 Is wxEuphoria available on Widgets 2.9.3?
Edit: Fixed broken </eucode> tag. -Greg
5. Re: wxEuphoria - Menu Font
- Posted by ghaberek (admin) Mar 11, 2012
- 1375 views
The example above looks very good but i am not able to get it working
I tried various ways of Set_Font, set_font, setfont, etc on several of the menuitems created. the only syntax accepted is the one with lowercase only and an underscore.
set_font(MenuNew,euTNRItal12) set_font(MenuSave,euTNRItal12) set_font(MenuCopy,euTNRItal12)
However, on execution it does NOT change the font of those MenuItems.
I am using Windows XP and wxEuphoria version 16 on top or Euophoria 4.0.3
I think the version of wxWidgets is 2.8.12
Indeed, it simply will not work right. Matt or myself will have to implement such functionality into wxEuphoria, which is why I proposed calling the function set_menuitem_font().
Is wxEuphoria available on Widgets 2.9.3?
Not yet, but I think Matt's been working on it. There were originally some compiling issues since we were still using Watcom. Lately we've been using MinGW and/or GCC which gets around those issues. Honestly, I'd like to rebuild the whole thing using namespaces and separate include files for each major class to keep down the bulk of the library (it's huge!)
-Greg
6. Re: wxEuphoria - Menu Font
- Posted by EUWX Mar 11, 2012
- 1329 views
Thanks for the explanation.
Is there a work around worth experimenting with?
e.g. create a parent window, change the default font, etc., and then hide this window and create a child window which inherits all the new settings in the parent.
7. Re: wxEuphoria - Menu Font
- Posted by mattlewis (admin) Mar 12, 2012
- 1314 views
Thanks for the explanation.
Is there a work around worth experimenting with?
e.g. create a parent window, change the default font, etc., and then hide this window and create a child window which inherits all the new settings in the parent.
Only if you can update the C++ wrappers and euphoria wrappers and rebuild wxEuphoria. It's actually not very difficult (all things considered), but requires a bit of C++ knowledge. The problem is that you have to call a method that's part of the wxMenuItem class which is not currently wrapped.
Actually, the way to go here is probably to update the code for set_font to check the object type passed (wxWidgets has its own built-in RTTI system). Currently, it only operates on wxDC objects, but we could detect wxMenuItem objects and call the appropriate method. The code is in wxGraphics.cpp, if anyone is feeling up to it.
Matt
8. Re: wxEuphoria - Menu Font
- Posted by EUWX Mar 12, 2012
- 1294 views
Thank you all for your help and suggestions.
While I wait for the 2.9.3 dependent version of wxEuphoria, I will try to look for Windows only software that can programatically and interactively change the default fonts for the title and menu. If I find this in a DLL with documented API, that would be even better. Such a facility, I presume, will enable me to make the necessary connection to the DLL using Euphoria facilities.
I feel that the application programmer should be able to have full control of the looks of the Window right from the beginning, without expecting the end-user to do special settings in the Windows Display settings through the Control Panel.
As an application programmer, I would prefer that I spoon feed the first window the way I think it should be and immediately allow the end-user to change the looks to the extent compatible with the software I am giving him.
All of the above comments apply to Microsoft Windows. I do not know Linux or Mac to make any comments.
9. Re: wxEuphoria - Menu Font
- Posted by ghaberek (admin) Mar 12, 2012
- 1311 views
Thanks for the explanation.
Is there a work around worth experimenting with?
e.g. create a parent window, change the default font, etc., and then hide this window and create a child window which inherits all the new settings in the parent.
Only if you can update the C++ wrappers and euphoria wrappers and rebuild wxEuphoria. It's actually not very difficult (all things considered), but requires a bit of C++ knowledge. The problem is that you have to call a method that's part of the wxMenuItem class which is not currently wrapped.
Actually, the way to go here is probably to update the code for set_font to check the object type passed (wxWidgets has its own built-in RTTI system). Currently, it only operates on wxDC objects, but we could detect wxMenuItem objects and call the appropriate method. The code is in wxGraphics.cpp, if anyone is feeling up to it.
I thought about that. We should probably break it out to handle all the classes that support SetFont() instead of just wxDC.
Thank you all for your help and suggestions.
While I wait for the 2.9.3 dependent version of wxEuphoria, I will try to look for Windows only software that can programatically and interactively change the default fonts for the title and menu. If I find this in a DLL with documented API, that would be even better. Such a facility, I presume, will enable me to make the necessary connection to the DLL using Euphoria facilities.
Mixing third-party libraries with wxEuphoria (or wxWidgets itself) is going to be difficult at best. wxWidgets maintains its own C++ classes derived from wxObject. They are not directly compatible. You should be able to call get_handle() on any wxWindow and pass that through to your third-party library. But wxWidgets may be performing other "magic" in the background that could change the expected behavior of that library. YMMV
I feel that the application programmer should be able to have full control of the looks of the Window right from the beginning, without expecting the end-user to do special settings in the Windows Display settings through the Control Panel.
As an application programmer, I would prefer that I spoon feed the first window the way I think it should be and immediately allow the end-user to change the looks to the extent compatible with the software I am giving him.
All of the above comments apply to Microsoft Windows. I do not know Linux or Mac to make any comments.
Have you tried using wxAUI? (Advanced User Interface) It doesn't allow you full control over the user interface, but it certainly gives you a lot more customization than you would normally have with the vanilla widgets.
I am also working on "themes" for wxAUI, eventually...
-Greg
10. Re: wxEuphoria - Menu Font
- Posted by mattlewis (admin) Mar 12, 2012
- 1304 views
I thought about that. We should probably break it out to handle all the classes that support SetFont() instead of just wxDC.
Absolutely. You can take a look at something like wxList.cpp:get_selection() for an example.
I feel that the application programmer should be able to have full control of the looks of the Window right from the beginning, without expecting the end-user to do special settings in the Windows Display settings through the Control Panel.
As an application programmer, I would prefer that I spoon feed the first window the way I think it should be and immediately allow the end-user to change the looks to the extent compatible with the software I am giving him.
All of the above comments apply to Microsoft Windows. I do not know Linux or Mac to make any comments.
Have you tried using wxAUI? (Advanced User Interface) It doesn't allow you full control over the user interface, but it certainly gives you a lot more customization than you would normally have with the vanilla widgets.
From looking at the screenshot that Greg posted earlier, changing the font appears to trigger a "user drawn" menu. That means that when the menu item has to be drawn, Windows calls your application and tells it to draw it, so you can use whatever font, etc that you desire. Obviously, wxWidgets is taking care of this for us. There's no reason why you couldn't implement something like this in Win32Lib (maybe it is already, even).
Matt
11. Re: wxEuphoria - Menu Font
- Posted by ghaberek (admin) Mar 12, 2012
- 1311 views
From looking at the screenshot that Greg posted earlier, changing the font appears to trigger a "user drawn" menu. That means that when the menu item has to be drawn, Windows calls your application and tells it to draw it, so you can use whatever font, etc that you desire. Obviously, wxWidgets is taking care of this for us. There's no reason why you couldn't implement something like this in Win32Lib (maybe it is already, even).
Don Phillips' Extra Controls demonstrates this with its "picture menus".
-Greg
12. Re: wxEuphoria - Menu Font
- Posted by EUWX Mar 12, 2012
- 1248 views
Another multiplatform GUI had this for creating a Window
- Creates a Window definition.
- Creates a Window definition.
SYNTAX
Standard Window:
DEFINE WINDOW <WindowName>
[ AT <nRow> ,<nCol> ]
[ ROW <nRow> ]
[ COL <nCol> ]
WIDTH <nWindth>
HEIGHT <nHeight>
[ VIRTUAL WIDTH <nVirtualWindth> ]
[ VIRTUAL HEIGHT <nVirtualHeight> ]
[ TITLE <cTitle> ]
[ ICON <cIconName> ]
[ WINDOWTYPE STANDARD ]
[ MAIN | CHILD | MDI | PANEL ] | [ WINDOWTYPE MAIN | CHILD | MIDI | PANEL]
[ NOSHOW ]
[ TOPMOST ]
[ PALETTE ]
[ NOAUTORELEASE ]
[ NOMINIMIZE ]
[ NOMAXIMIZE ]
[ NOSIZE ]
[ NOSYSMENU ]
[ NOCAPTION ]
[ CURSOR <CursorName> ]
[ ON INIT<InitProcedureName> | <bBlock> ]
[ ON RELEASE <ReleaseProcedureName> | <bBlock> ]
[ ON INTERACTIVECLOSE <InteractiveCloseProcedureName> | <bBlock> ]
[ ON MOUSECLICK<MouseClickProcedureName> | <bBlock> ]
[ ON MOUSEDRAG<MouseDragProcedureName> | <bBlock> ]
[ ON MOUSEMOVE<MouseMoveProcedureName> | <bBlock> ]
[ ON MOVE<MoveProcedureName> | <bBlock> ]
[ ON SIZE<WindowSizeProcedureName> | <bBlock> ]
[ ON MAXIMIZE <WindowMaximizeProcedureName> | <bBlock> ]
[ ON MINIMIZE <WindowMinimizeProcedureName> | <bBlock> ]
[ ON RESTORE <WindowRestoreProcedureName> | <bBlock> ]
[ ON PAINT<WindowPaintProcedureName> | <bBlock> ]
[ ON DROPFILES {|aFiles| TakeDrop(aFiles)} ]
[ BACKCOLOR <anBackColor> ]
[ FONT <cFontName> SIZE <nFontSize> ]
[ NOTIFYICON <cNotifyIconName> ]
[ NOTIFYTOOLTIP <cNotifyTooltip> ]
[ ON NOTIFYCLICK <NotifyClickProcedure> | <bBlock> ]
[ ON GOTFOCUS <ProcedureName> | <bBlock> ]
[ ON LOSTFOCUS <ProcedureName> | <bBlock> ]
[ ON SCROLLUP <ProcedureName> | <bBlock> ]
[ ON SCROLLDOWN <ProcedureName> | <bBlock> ]
[ ON SCROLLLEFT <ProcedureName> | <bBlock> ]
[ ON SCROLLRIGHT <ProcedureName> | <bBlock> ]
[ ON HSCROLLBOX <ProcedureName> | <bBlock> ]
[ ON VSCROLLBOX <ProcedureName> | <bBlock> ]
[ HELPBUTTON ]
... Control Definitions...
END WINDOW #
Their Menu creation also has a Font part in the composition of the whole. It would seem that they felt it was useful to give all that flexibility.
So I would think it is possible in a multi platform GUI.
If I have to digress from wxEuphoria, I would like to think that it is a temporary use of your Win32Lib pending wxEuphoria-2.9.3 based.
However, the whole of the syntax is pretty different and I would need to rewrite for multi-platform use.
13. Re: wxEuphoria - Menu Font
- Posted by ghaberek (admin) Mar 13, 2012
- 1178 views
So I would think it is possible in a multi platform GUI.
If I have to digress from wxEuphoria, I would like to think that it is a temporary use of your Win32Lib pending wxEuphoria-2.9.3 based.
However, the whole of the syntax is pretty different and I would need to rewrite for multi-platform use.
Why not build your application with wxEuphoria as it is, and then set the fonts later?
Personally, I try to focus on the implementation of the program first, not the interface.
-Greg
14. Re: wxEuphoria - Menu Font
- Posted by EUWX Mar 13, 2012
- 1181 views
Thanks for the advice.
To rewrite in wxEuphoria after writing in win32lib would be a time consuming exercise in futile wandering.