Can a Mac user run this and post a screenshot?

BlitzMax Forums/MaxGUI Module/Can a Mac user run this and post a screenshot?

sswift(Posted 2009) [#1]
I'm rewriting my Seamles Texture Generator in BlitzMax, and since I'll be making it available for Mac, I want to make sure my controls are a good size on both systems.

I noticed when I sized my trackbar sliders the same size I had the old ugly scrollbar sliders on XP, the knob ended up being tiny, and hard to click. So I set each one to be a different size, incrementing it from 16 pixels up to 24 pixels, to see how the size of the knob changed.

Then it occured to me that since the knob size doesn't change between 22 and 24 pixels on XP, that maybe it doesn't get any smaller than that on Macs, ever.

So I'd like to see how this looks on the Mac, so I can decide just what sizes are okay to use.




Here's how it looks on my system:





Oh, and when you run this, run it from the IDE, there's no way to exit otherwise.

And hit the restore window button when you run it to make it snap back to 640x480 from fullscreen. No sense in taking a huge screenshot.


N(Posted 2009) [#2]



Redspark(Posted 2009) [#3]


Looks the same for me as well. :)


sswift(Posted 2009) [#4]
Thanks!

Hm. I guess I'm gonna have to do some tests with the size of the textboxes as well.

Looks like the slider has to be a minimum of 20px. But it also looks like the text boxes must be a minimum of 24px tall. I come to that conclusion based on the 10px font size, + 6px of blank space above in the textbox, a presumed 6px of blank space below, and the box itself adding 2px.

Damn. I didn't really want to go that large.


I'll post a new test shortly with the new sizes.


sswift(Posted 2009) [#5]
On second thought, looking at some other mac screenshots, it looks like they default to 22px, so I'll try that.


Redspark(Posted 2009) [#6]
Is there a way to shrink the internal margin within the text box?


sswift(Posted 2009) [#7]
I don't think there is.


Brucey(Posted 2009) [#8]
Hm. I guess I'm gonna have to do some tests with the size of the textboxes as well.

Welcome to MaxGUI :-)


sswift(Posted 2009) [#9]
Let's see how this looks:




Wiebo(Posted 2009) [#10]
You'll never get it right or only after hours of tweaking... Why don't you try wxWidgets? Brucey's module for it is very good. It will enable you to create gui's with identical layout over 3 OSses... And wxFormBuilder is a great tool to create your forms.


sswift(Posted 2009) [#11]
Why? Because until just now I never even knew it existed? :-)


sswift(Posted 2009) [#12]
Hm... Well this looks interesting.

I hate to have to redo everything from scratch, but since I was going to have to redesign the form anyway to accomodate new features...


Well, thanks for pointing that out! I may well use it. I'm gonna see if I can recreate what I've done with that form editor.


sswift(Posted 2009) [#13]
Weibo:
What planet are you from? :-)


I downloaded Brucey's Mod, and the wxFormBuilder, and while in theory, a form builder should speed up development...

1) I can't find a manual for the thing so I can't even figure out how to turn on the grid, and when I try to create a control it tells me I haven't created a "sizer" whatever that is.


2) I found a wiki on the form builder, which is a poor subsitute for a manual, but I get stuck on the very first step:

"Choose which code will be generated. Currently, you can generate C++ and/or XRC code."

Which do I need to generate for Brucey's module? No clue. No idea where to look to get a clue.


3) Brucey's module has like a thousand different functions contained in 50 different modules, and I have absolutely no clue where I should start reading. Plus it's all object oriented with all kinds of types and methods and stuff. I can deal with object oriented stuff, but I open the help file for, let's say wxcoordialog, and I get functions types, function types, and looking at them I haven't got a clue what to do with any of them.


In short, it would take me a month to figure all this out and become proficient in it. For what? To save me "hours" of tweaking and give me a few extra gadgets to play with like fancy tabs? I can live without those.


I appreciate the suggestion, and Brucey sure put a lot of work into that and I'm thankful for his stuff, but... I'm not making Photoshop or Microsoft Office here. :-)


Wiebo(Posted 2009) [#14]
Yes you will have to start from scratch, and its HEAVILY OOPed... If that's too much at this stage of your development then reconsider. I spend a few days getting my head around things but now I wouldn't want it any other way.

I understand you don't want to create an enormous app. I reacted to your layout problems with maxGUI on different platforms, and wxMAX might indeed be too 'much'. But there is also a LOT more functionality in wxMAX as opposed to maxGUI, which you might like. So I would consider it for a major app if you are starting development of one.

But to answer your questions:

1) wxWidgets don't work with a grid. They work with sizers to align gadgets. This is indeed the thing that makes it great cross-platform. It eliminates the grid which is slightly different on each platform.

2) wxMAX comes with it's own bmax code generator. It's located in wx.mod/tools/wxcodegen

This tool contains two important tabs
- project config: create bmax form code here
- application code: generate the code to interface with your gui

3) Don't read Brucey's code. It's evil! :) Go here: http://docs.wxwidgets.org/trunk/annotated.html

Also, you could check out my particleMAX project page and see how I created the editor with wxWidgets: http://code.google.com/p/particlesmax/
The svn even contains the wxFormBuilder project file so you can check it out: http://code.google.com/p/particlesmax/source/browse/trunk/Forms/ParticleEditor0.1-2.fbp

The great thing is, you don't ever have to touch the generated code file, just override the functions as generated in the application code.
And wxMAX event handling is superior to MAXgui's.


Brucey(Posted 2009) [#15]
Don't read Brucey's code. It's evil!

Gee, thanks :-p

OOP isn't so bad. Apparently it's used by quite a lot of professional programmers, so it must have something going for it ;-)
But obviously it's quite a big step from a mostly procedural language such as BlitzPlus.


But anyways... nice of you to take a look at it.

Good luck with your Mac port of your texture app.

:-)


sswift(Posted 2009) [#16]
Don't read Brucey's code. It's evil!


http://www.youtube.com/watch?v=v60-qRvmzKA


sswift(Posted 2009) [#17]
Don't get me wrong, I use OOP type stuff in my code, and I kinda get how the types are related to the buttons and things from my Visual Basic background, but there's just so much to take in at once with this setup and it doesn't translate to a help file which is particular easy to understand and navigate.

Or maybe I don't get it. Looking at the help for a checkbox:

Methods Summary 
Create Creates the checkbox for two-step construction.  
Get3StateValue Gets the state of a 3-state checkbox.  
GetValue Gets the state of a 2-state checkbox.  
Is3rdStateAllowedForUser Returns whether or not the user can set the checkbox to the third state.  
Is3State Returns whether or not the checkbox is a 3-state checkbox.  
IsChecked This is just a maybe more readable synonym for GetValue.  
Set3StateValue Sets the checkbox to the given state.  
SetValue Sets the checkbox to the given state.  


In visual basic, with the OOP method, what I would expect was that the checkbox would have a function that is called when its state is changed. In that function is where I'd put my code to do whatever it is that needs to be done when that state changes.

But barring that, I would have assumed the state would be passed to some kind of event handler, but I see no mention of what sort of events a checkbox might generate or where.

I also have no idea what that Create() function is supposed to do. Presumably the checkbox would have been created by the code that sets up the form in the first place.

It also makes no sense to have four different functions to get and set the state of a checkbox depending on whether it has two or three states. If you absolutely must treat two and three state checkboxes differently, why even package them in the same type?

Not Brucey's fault of course, I'm sure he just translated the code directly from the original lib. But still, none of this makes any sense to me.


Wiebo(Posted 2009) [#18]
Don't go there! Like i said: Use the web docs

http://docs.wxwidgets.org/stable/wx_wxcheckbox.html#wxcheckbox

Those docs are for the official wxWidgets source, but Brucey followed that extremely close.


sswift(Posted 2009) [#19]
Okay, I'll look at the web docs. :-) But I get the feeling I shouldn't even be looking at that checkbox page. I don't need to know how to create a checkbox or set it.

All I want to know how to do right now is create a form with a few controls, load and display it in BlitzMax, and get events from those controls.

Then I can worry about how to set a checkbox. :-)


Wiebo(Posted 2009) [#20]
OK. You wanna invest in this?

Then do this:

- Load up wxFormEditor and create your form. You will have to get used to it. Download the file from my google page if you wanna take a look at how it's done. Export the .fbp file.
- Start the code exporter from wx.mod/tools/wxcodegen
- Click Add (left bottom) and create a new project
- Browse to the project file (.fbp)
- fill in the detination folder and file name
- click Generate (right bottom) to create the max code for the form.
- go to the application tab and save the application code, or copy/paste
- open the application code in bmax, and fill in the methods as mentioned in the source code. you might need to add the wx modules that you're using.

If you want to know how to interact with the gadgets in your form, go to the wxWidgets docs. Sorry, but that's how that part is done. We'll get to that once you're at that stage.

That is basically it. I might have missed some details. I hope not.
Just yell when you need more detail.


Brucey(Posted 2009) [#21]
Well, if you can wait a few hours, I'll have a go at making a (very) basic tutorial/walkthrough with screenshots of wxFormBuilder.

On a very simple level, you'd kind of do this :

* Forms Tab -> new Frame.
* Layout Tab -> new wxBoxSizer
* Containers -> new Panel
* Layout -> new wxBoxSizer
* Common -> new CheckBox

(The above is just doing these in order using the defaults, without changing anything else)

In Object Properties (on the right, usually), select Events tab.
In "OnCheckBox", enter the name of a callback method. Let's say, "OnChecked".

That's a basic main-window with layouts and something to click on.

Click on the MyFrame1 tree node, and give it a different name. This will be the name of your generated Type for the frame. Let's call it "TestFrame".
You can add title and centering etc there too, if you like.

Save the project. It will have a .fbp extension.

----

You'll need to build the code generator.
It's in the tools/wxcodegen folder.

Open wxCodeGen.bmx in Blitz, and build/run it.

Assuming that works :

* Add new project.
* Browse for the project file.
* Add a destination folder for your BlitzMax project (this is where it will generate the code).
* Give the generated file a name. (Anything you like. You won't be editing this file, only importing it. It adds ".bmx" for you)

Once you've filled everything in, you can try to Generate. (There are some options to have it auto-generate whenever wxCodeGen is running and you re-save the project file).

Now you have some generated code, click on the "Application Code" tab, and you'll see a small example implementation, which you can copy and paste into a NEW BlitzMax file.
Think of it like an application stub.

If you added an event for the checkbox click, you should see something like this :
Type TestFrame Extends TestFrameBase

	Method OnInit()
		Super.OnInit()

		' Add own initialisation code here

	End Method

	Method OnChecked(event:wxCommandEvent)
		' TODO : Implement me
	End Method

End Type


One small snippet that it doesn't current do, is some example "frame creation code".
In the MyApp OnInit() method, you'll see "Add frame creation code here".
Something like this :
		Local frame:TestFrame = TestFrame(New TestFrame.Create())
		frame.Show()

Will create your frame and show it.

If you've generated the file and created the other in the same folder, it should be runnable immediately.

To see the checkbox event work, stick a DebugLog in the method. It should be called everytime you click on it.

HTH

:o)

(It's a bit rough. Apologies... lunchtime over!)

<EDIT>Seems Wiebo beat me to it ;-)


Wiebo(Posted 2009) [#22]
you type too fast. go away.


Brucey(Posted 2009) [#23]
you type too fast.

Far too many hours IRC'ing when I was younger :-p
(people get irritated if you can't keep up)


Oh, and FYI, wxCodeGen is a wxFormBuilder project. The fact that it can generate itself is kinda cool ;-)
(all the source is there too)


Wiebo(Posted 2009) [#24]
Well the added detail might help sswift on his new quest.


sswift(Posted 2009) [#25]
Brucey:
Wow. Thanks for all that, :-)


So uh... If I'm reading this right, it seems like it does work kinda like Visual Basic, but instead of simply creating the methods automatically for you with predefined names, you have to name them yourself in the form editor?

Hm. Well, makes sense at least.


What's an application stub? My google-fu isn't working.


sswift(Posted 2009) [#26]
Weibo:
Thanks for your help too. And yes, it might. :-)


Brucey(Posted 2009) [#27]
What's an application stub?

A basic framework or skeleton application to help you get started - rather than having to code everything from scratch.


sswift(Posted 2009) [#28]
So I figured out how to create a tabber, which wxformbuilder refers to as a notebook. And I managed to create some tabs in it by adding some panes.

But how do I make the tabs look all fancy like those in formbuilder itself? I want to use that nifty Firefox 2 style you can set if you right click on the tabber.


sswift(Posted 2009) [#29]
Nevermind auinotebook seems to have that style. Though there's this weird notch cut out of the right side of each tab I can't figure out how to get rid of.


GaryV(Posted 2009) [#30]
sswift: You might want to buy the book on wxWidgets. It is very helpful with Brucey's mod.


Wiebo(Posted 2009) [#31]
Well, he only need one window with a few sliders and a button. Does he need a book for that? =]


GaryV(Posted 2009) [#32]
Well, he only need one window with a few sliders and a button. Does he need a book for that? =]
Just trying to help, a little help for something as complex as wxWidgets might be useful and save him some trouble and frustration in the long run.


Brucey(Posted 2009) [#33]
It's also a very good book.


sswift(Posted 2009) [#34]
How do macs deal with the menus? I just noticed they aren't at the tops of my window on the mac screenshots.


Wiebo(Posted 2009) [#35]
It's also a very good book.

I'd prefer 'The Lord of the Rings', also very good!

How do macs deal with the menus?

Steve Jobs didn't want them..... honestly, I don't know sswift.


Brucey(Posted 2009) [#36]
How do macs deal with the menus?

There's a global menu bar at the top of the screen.
Applications share that.


markcw(Posted 2009) [#37]
It saves some space.