wxMax Basic Samples - What do we need?

BlitzMax Forums/Brucey's Modules/wxMax Basic Samples - What do we need?

Brucey(Posted 2008) [#1]
Given the general problems people have when starting out with wxMax, given both its size and different way of working (compared to MaxGUI), what subjects should a set of basic samples try to cover?

I realise that the current samples, ported from the wxWidgets C++ samples, tend to be all-encompassing and a bit too complex to use as a quick guide to understanding a specific feature.

So, what do we need?

:-)


SebHoll(Posted 2008) [#2]
Basic programs that would definitely help me with coming to terms with wxWidgets (if I get round to it) would be:

> Simple Text Editor (like Notepad: text control, menu for save/open/exit/about/select all/copy/paste etc., perhaps a find requester window)?
> Basic HTML Browser (web object; text field for web addresses; buttons to navigate forward and backward)
> Simple multi-column listbox example (e.g. displaying data from a multi-dimensional array).

Just a few ideas of the top off my head, perhaps someone else can think of better examples. Cheers!


slenkar(Posted 2008) [#3]
I was hoping someone would do this - thanks!

creating all types of button (bitmap and text) and getting the state (e.g. pressed, not pressed)

a demo that shows ALL possible color changes, like changing the colour of the widgets.

creating a combobox and getting all the different states

creating other widgets by themselves,(esp. radiobutton and checkbox)

removing widgets from the screen ('hiding' or 'freeing') and replacing them with other widgets when a button is pressed(in a way that doesnt cause a memory leak)

adding images into a combobox - and other widgets if possible

editing a combobox - removing elements and adding elements

cant think of any more at the moment


Glenn Dodd(Posted 2008) [#4]
I have spent a lot of time using wxFormBuilder and wxCodeGen.
I think some examples of designing simplistic forms (one with menus only, one with some basic controls, a form that opens a dialogbox and returns the values to the controls, etc) and then how to use the resulting wxCodeGen code ie save the code from the GENERATE button as a GUI file and save the code from the Application Code tab to a Main file.
There are some commands for "Type MyApp Extends wxApp" which i struggled to realise were needed there. for example i added a graphic to my GUI and didn't know that "wxInitAllImageHandlers()" was needed to make them work, along with "wxImage.AddHandler( New wxXPMHandler )". Also "wxSystemOptions.SetOption(wxWINDOW_DEFAULT_VARIANT, wxWINDOW_VARIANT_SMALL)" seems to be a required command from Macs.

Having this in the Applicaton Code tab would be useful too.


I think recommending to beginners like myself to use wxFormBuilder and wxCodeGen is a good idea. More experienced users may not need it but i certainly did.
It would be good if wxFormBuilder came with its own samples folder with pregenerated wxCodeGen code.
I like the fact that wxFormBuilder forces me to use Sizers which simplifies things later one.

I am happy to help with some simple examples with comments, as long as someone more experienced reviews them before they get posted.

Cheers
Glenn


Vilu(Posted 2008) [#5]
I myself found it very difficult to do a fluidly working "main loop" type of thing, which I eventually managed to accomplish with a timer attached to an event. The supplied main loop example didn't cut it, as the loop didn't run while the window was being moved, resized, etc.

As wxMax is very event-based, a good rundown of events, how they are created and attached to functions is really called for.

I think recommending to beginners like myself to use wxFormBuilder and wxCodeGen is a good idea. More experienced users may not need it but i certainly did.


I think wxFormBuilder is a real life-saver for beginners and experts alike. It's a truly working fast WYSIWYG GUI editor supporting nearly every imaginable widget I would ever use. It took a bit of settling in to do, but I think I got a fairly good idea on how to do things with wxFormBuilder + wxCodeGen. The idea behind Sizers was quite hard to grasp, but when I did, there was no going back!


nadia(Posted 2008) [#6]
I also think wxFormBuilder with wxCodeGen is fantastic, mainly if you want to build a bit more complex GUI's.

There is one little spot in wxCodeGen which might be worth while to get fixed. I tend to make frequent use of spacers to get the widgets to align properly within a form and those spacers get lost in the code produced by wxCodeGen. For me it's not a big deal, I just go through the C++ code and copy/paste them into the Bmax code, making sure to convert them into the right wxMax gadget. They can be either:
.AddSpacer
.AddCustomSpacer
.AddStretchSpacer,
depending on the properties they got in the C++ code. This of course also makes it a bit more complicated to auto-convert them with wxCodeGen, but it usually only takes a few minutes to add them manually into the BMax code...

ahem -- I hope the above prattle makes sense ;-)


Vilu(Posted 2008) [#7]
I tend to make frequent use of spacers to get the widgets to align properly within a form and those spacers get lost in the code produced by wxCodeGen.


How do the spacers get lost? I've not had any problems with generated spacers.

The beauty of wxCodeGen is that you'll never have to touch the generated code at all. It makes modifying and maintaining the GUI layout a lot easier to leave the generated code alone and stick with the event functions supplied by the generator. I've yet to encounter a situation requiring me to modify the GUI code itself.


nadia(Posted 2008) [#8]
Hi Vilu,
just to make sure - I'm talking about Spacers, not Sizers.
Spacers definitely don't get generated with my version of wxCodeGen (v1.01), downloaded from the SVN repository. Maybe you got a never version. If so, please tell me where to get it!
But you're right, otherwise the generated GUI code needs rarely any tweaking, wxCodeGen IS fantastic! ;-)


Vilu(Posted 2008) [#9]
Ah, I mixed them up. :) Spacers seem to be missing in the generated code.


slenkar(Posted 2008) [#10]
where is wxformbuilder?

EDIT-

oh hang on, so you use wxformbuilder (the downloadable program) with wxcodegen?

EDIT-
doesnt seem you can change any colors with the formbuilder except button text


nadia(Posted 2008) [#11]
You can change just about all colours to your hearts contents!
In the property panel on the right in the yellow section towards the bottom you get fg (foreground) and bg (background) colour settings. If you click on them a list with windows def colours pops up. Scroll right down to the bottom where you get a CUSTOM item which opens the colour selection panel...
Please Note:
Changing the fore/back-ground colour of some container widgets like panels will also change the default colour settings of the child widgets placed on them.


Yahfree(Posted 2008) [#12]
Just a well documented one would do well, with some basic gadgets in it


slenkar(Posted 2008) [#13]
thanks nadia I went back and looked and you can change colors.
Do you know how to change the color of a combobox button? the button on the right of the combobox always stays grey


nadia(Posted 2008) [#14]
most likely you can't change the combo box button since it is controlled by the operating system.

I thought maybe you can do something by messing around with the wxPaintEvent but the documentation doesn't encourage that:

A paint event is sent when a window's contents needs to be repainted.

Please notice that in general it is impossible to change the drawing of a standard control (such as wxButton) and so you shouldn't attempt to handle paint events for them as even if it might work on some platforms, this is inherently not portable and won't work everywhere.



Brucey(Posted 2008) [#15]
There is an owner-drawn combobox widget that might be able to handle colour changes, but I don't think I've implemented that yet.
I think, as the name suggests, the user has more control over what gets drawn.


slenkar(Posted 2008) [#16]
the colour changes are good enough I spose, thanks for all the help