center alignment in wxFlexGridSizer?

BlitzMax Forums/Brucey's Modules/center alignment in wxFlexGridSizer?

UNZ(Posted 2013) [#1]
When I add the wxALIGN_CENTER or wxCENTER flag to a widget it is not centered. Other flags fail as well. Is this a bug?

I modified the flexgrid example a little:


thx


Brucey(Posted 2013) [#2]
Is this a bug?

Possibly. I'll look into it :-)


Brucey(Posted 2013) [#3]
Try this instead :
fgs.Add(review, 1, wxALIGN_BOTTOM)


I used wxFormBuilder to try out different things - helps to quickly see what happens when you change flags/styles.


UNZ(Posted 2013) [#4]
I tried wxALIGN_BOTTOM/wxBOTTOM and wxALIGN_CENTER/wxCENTER and wxALIGN_RIGHT/wxRIGHT etc. but none of them has any effect in the example above.

If it works in wxFormBuilder it is possibly a bug?


Brucey(Posted 2013) [#5]
I tried it in your above example and it worked for me (on OS X).

I also just this moment re-tried the above example on Linux and it also worked for me with my above-mentioned change.


Derron(Posted 2013) [#6]
Using UNZs example, all 3 labels are top-aligned.
Changing to "wxALIGN_BOTTOM" moved the review-label to the bottom (as wanted).


bye
Ron


UNZ(Posted 2013) [#7]
You're right.
It works. But only without wxEXPAND set. So
fgs.Add(review, 1, wxALIGN_BOTTOM)
works and
fgs.Add(review, 1, wxEXPAND | wxALIGN_BOTTOM)
don't.

But that is enough for me.


Brucey(Posted 2013) [#8]
But only without wxEXPAND set.

That's because you are aligning the static text control, not the contents of the static text. When you use wxEXPAND, the static text control fills the whole space from the top of the multi-line textbox to the bottom, and therefore using TOP or BOTTOM would show no difference.


Derron(Posted 2013) [#9]
The behaviour is logical as soon as you can align the content, else each special alignment (left, right, top, bottom - contrary to "use all space") should be "intelligent" enough to be considered for content.
But that would be a mistake made by wxWidgets, not your implementation.


bye
Ron

edit: spelling bee was there for corrections.


UNZ(Posted 2013) [#10]
Makes sense.