TextBox text alignment

AndiNo

23-09-2009 21:55:36

Hi again! I was just trying to align some text inside a textbox, however I seem to not fully understand it. I tried this:
QuickGUI::TextBoxDesc *tbd = QuickGUI::DescManager::getSingleton().getDefaultTextBoxDesc();
tbd->textDesc.horizontalTextAlignment = QuickGUI::TEXT_ALIGNMENT_HORIZONTAL_CENTER;
tbd->textDesc.verticalTextAlignment = QuickGUI::TEXT_ALIGNMENT_VERTICAL_CENTER;
tbd->textDesc.segments.push_back(QuickGUI::TextSegment("micross.12", QuickGUI::ColourValue::Red, "127.0.0.1"));
QuickGUI::TextBox *editBox = mySheet->createTextBox(tbd);

However this does have no effect on text alignment at all. It worked after I used this:
editBox->setHorizontalTextAlignment( QuickGUI::TEXT_ALIGNMENT_HORIZONTAL_CENTER );
1. Why doesn't it work with the first way?
2. Where can I set the vertical alignment of text? There has to be another function with similar effect to the one above...

kungfoomasta

24-09-2009 00:56:09

the TextBox init function must not be making use of the passed in property for text alignment. I'll also add in the API to set the vertical alignment of the text. Hopefully tonight I'll add it in.

kungfoomasta

24-09-2009 02:18:55

Should be fixed in SVN.

AndiNo

24-09-2009 10:06:55

Thanks, that was really fast :) I'll try it out now. Could you explain why it MUST NOT make use of the properties?

edit: I tried it and it seems to work. However it seems that TEXT_ALIGNMENT_VERTICAL_CENTER is standard for textboxes, which I didn't realize because my textbox was too small. Anyway, thanks for your help :)

AndiNo

24-09-2009 11:40:41

Sorry for double posting, but I don't want to make so much new topics here ;)
How do I add children to widgets? Or in my case, how do I add a button to a panel? addChild and setParent are protected, how does this work?

kungfoomasta

24-09-2009 19:18:53

myPanel->createButton(...);

The library is not generic in the sense that you can add any widget to any other widget. Each wiget class will outline via API what it can create. For example you can't create a window and add it to a label as a child.

AndiNo

24-09-2009 22:38:46

Ah I see. Then it's not possible to create a widget (button, etc) and then add it as a child somewhere? That's ok, but a bit confusing ^^

kungfoomasta

24-09-2009 23:14:11

Really? I thought it would be more intuitive. Code Blocks has some form of intellisense right? If you have a widget class, you can view all the "create" methods, to see what widgets that particular widget can create as children. If I didn't design it this way, there would be no rules, and people would be able to add TitleBars to Buttons, (or other illogical combinations) and things would become really unpredictable. (Not to mention I would get lots of error reports of people trying to do things in various ways I haven't supported. GUIs are very complex..)

Maybe its the test engineer side of me, but I like things to be very predictable. :)

AndiNo

24-09-2009 23:31:04

First, yes, CodeBlocks has this feature. But although I can understand you, from an outsider's view it doesn't look very (what should I say... professional?) when there are so many create functions (while there should be one like addChild(Widget *w)). This may now sound very negative from my side which it shouldn't be, but as I used wxWidgets before I think there are no such restrictions (at least widgets can be attached to each other after creation IIRC) and thus there are not these many create functions. It's okay this way, just wanted to point out my experiences :) I fully understand you, but maybe you could just let people make mistakes and produce errors, but they have to be aware that you just can't add a titlebar to a button for example. But in the end, it's a design decision so it's up to you :)


edit: And finally, one last alignment question :) I want to make a crosshair which is always centered on the screen. I tried it this way:
QuickGUI::ImageDesc *id = QuickGUI::DescManager::getSingleton().getDefaultImageDesc();
id->widget_name = "crosshair";
id->image_imageName = "crosshair.png";
QuickGUI::Image *img = mySheet->createImage(id);
img->setHorizontalAnchor(QuickGUI::ANCHOR_HORIZONTAL_CENTER);
img->setVerticalAnchor(QuickGUI::ANCHOR_VERTICAL_CENTER_DYNAMIC);

But it does have no effect, the image is always at the topleft corner. And the crosshair is much bigger than that in the image file. What do I do wrong? Besides, I don't know what "dynamic" means...

Calder

25-09-2009 01:54:25

I'm with KFM on this one. I think the create* interface is much cleaner and more intuitive, as it tells you exactly what you can and can't do and doesn't allow unsupported actions.

kungfoomasta

25-09-2009 02:20:15

The "dynamic" anchors mean that if the parent widget's dimensions change, not only will the widget be in the center of the parent's client dimensions, but it will scale so that its sides are the same distance from it's parent's sides. (Stays in the center and grows/shrinks when parent grows/shrinks)

The ImageDesc has a default size, maybe its (50,50), I can't remember. If you want it to be a different size you should specify it. I could actually implement the feature where the image is the size of the skin is represents, if the user does not specify the size. (I think this is a good idea)

As for the centering not happening, that might be a bug, I'll have to repro and investigate.

AndiNo

25-09-2009 09:52:23

I could actually implement the feature where the image is the size of the skin is represents, if the user does not specify the size. (I think this is a good idea)
As for the centering not happening, that might be a bug, I'll have to repro and investigate.

That sounds like a good idea! And I hope it isn't my fault for which you sacrifice your time :-D

kungfoomasta

26-09-2009 01:05:42

Its all in SVN, anchor fixes and the feature we mentioned. :)

AndiNo

26-09-2009 15:26:08

I'm not able to connect to SVN. It doesn't accept the login name/pw. I'm using user name: userSSE2 password: read_only
Is this only a temporary error?

kungfoomasta

26-09-2009 19:06:57

Oops! I had that account deleted. (it somehow committed a bunch of crazy stuff to the repository last week, even though I think it only has read access..)

Let me request it be recreated. I'll re-upload the zip so you can get the changes there.

AndiNo

30-09-2009 21:37:24

The SVN account works again.
Now I have a problem with anchoring again (doesn't have to do with the update). I created some widgets via a sheet file. Here it is:
Sheet MainMenu
{
BaseColor 1 1 1 1
BrushFilterMode BRUSHFILTER_LINEAR
ClipChildrenToDimensions true
ClipComponentsToDimensions true
ConsumeKeyboardEvents false
ContextMenuName
Detectable false
Dimensions 0 0 800 600
DisabledSkinType
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_LEFT_RIGHT
HorzBarScrollPercent 0.2
HorzButtonScrollPercent 0.1
HoverTime 3
InheritOpacity true
MaxSize 0 0
MinSize 5 5
MoveBaseWidgetOnDrag false
PositionRelativeToParentClientDimensions true
RelativeOpacity 1
ResizeFromBottom false
ResizeFromLeft false
ResizeFromRight false
ResizeFromTop false
ScrollBarThickness 15
Scrollable true
SkinType default
SupportScrolling true
TransparencyPicking true
VertBarScrollPercent 0.2
VertButtonScrollPercent 0.1
VerticalAnchor ANCHOR_VERTICAL_TOP_BOTTOM
Visible true
XScrollOffset 0
YScrollOffset 0

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
Panel Main_Main
{
Dimensions 0 0 800 600
Dragable false
Enabled true
RelativeOpacity 1
SkinType default
Visible true

Child Widgets
{
Button Main_Singleplayer
{
Dimensions 50 100 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER_DYNAMIC
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 SINGLEPLAYER
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Button Main_Multiplayer
{
Dimensions 50 250 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 MULTIPLAYER
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Button Main_Exit
{
Dimensions 50 400 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 EXIT
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

}
}

Button connectToServerBtn
{
Dimensions 50 50 120 25
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.12 1 0 0 1 Connect to server
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}
}
}

The problem is, if I add the three big buttons as children of the sheet directly they are aligned in the center of the screen - as I wanted. But now I've added them to a panel which itself is a child of sheet, but they aren't centered anymore, they are positioned at the given positions. I even tried CENTER_DYNAMIC but no effect.

And one other request :) : Maybe it would be a good idea to only write those attributes to file (via saveToFile) which deviate from the standard values. I've also noticed that widgets created by sheet file don't automatically get the standard values (like Enabled=true). This would definately be a good idea ;) (I nearly always want a new button to be clickable...)

kungfoomasta

01-10-2009 01:49:02

Maybe it would be a good idea to only write those attributes to file (via saveToFile) which deviate from the standard values

I definately agree, I thought of this before, but its not so easy to implement in a clean way. Basically the way serialization works, I have one function that says what needs to be written and what needs to be read, it depends if I'm passed the SerialReader or SerialWriter. If I'm trying to read in a boolean property, and the property does not exist, I pass back a default value for that type of data, which is 'false'. (The alternative is to crash when I try to read a property that doesn't exist, not good IMO) This is why the enabled property is read in as false unless otherwise specified. I could flip the default bool to true, but then other missing properties will be assigned 'true' by default. I don't know whats better :P.

I think I could code in the 'smart' behavior, but it would take some effort, if in read mode I would have to query each properties existance, and read in from script if so. If in write mode, I would have to check if the value is non-default and write to script if so. Add this behavior to every property of every desc... would be quite a task. :wink:

As for the other anchoring issue, thats puzzling, but I should be able to repro at home.

AndiNo

01-10-2009 12:10:54

If I'm trying to read in a boolean property, and the property does not exist, I pass back a default value for that type of data, which is 'false'.So you're already checking if a specific property exists... you just have to set it to a default value dependant on what class it is (in Button make Enabled=true the default for example). Maybe it's too much work, but if it's feasible it would reduce the amount of lines needed in sheet files dramatically - and I plan to make the GUI in my game to be very sheet-file-heavy :)

edit: One other thing I noticed: When doing things like this Segment0 micross.12 1 0 0 1 Connect to serverwhy isn't the colour specified as RGBA but as ABGR instead? I see no reason for that :)

kungfoomasta

01-10-2009 19:37:59

probably alphabetical order, I wasn't sure if there was a standard order to it. :lol:

The serializer class doesn't know of an intended default, I just ask it to get me the value of a property, it gets a value. Or it sets a value. Depends on the serialization. If I modify the API it won't be so clean anymore, for example:

void serialize(SerialBase* b)
{
b->IO("PropertyName",&member);
}


The following code either gets the value of the property "PropertyName" and assigns it to 'member', or it takes the value of 'member' and writes it out as a property with name "PropertyName".

For reading, it would be nice to have something like

b->IO("PropertyName",&member,defaultValue);

but then this API really makes no sense for the SerialWriter. I'll have to think about it, but I would like to make things as simple as you've outlined.

kungfoomasta

01-10-2009 19:41:36

oh wow, it does work for the writer scenario. Basically if the value of the member is the same as the default property is the same, no need to write it to disk.

Thanks for helping me realize this! :D

b->IO("Enabled",&enabled,defaultDescValues->enabled);

The reader will try to read this property, if it doesn't exist, enabled is set to true.

The writer will try to write this value to disk, if enabled is set to true, the value is not written. Nice!

AndiNo

01-10-2009 20:52:43

I don't understand 100% of what you say, but I understand that it works and that's the most important thing :-D
PS: did you already find out something about the alignment error? (though I guess you're more involved with serialization at the moment ;) )

edit: A bit offtopic, but do you think you could add information in MouseEventArgs about whether it is a button up or button down event? This would be helpful.

edit2: I just tried setting the text on a Label after its creation. This works directly after creation with label->setText("text") but later it won't work anymore. I tried different settings but it always crashes with the following message:
Assertion failed: pRep, file D:/Programmieren/Tools/OgreSRC/OgreMain/include/OgreSharedPtr.h, line 152 I guess there's something wrong with my program but maybe you've got any idea?
And second, I got that working by using
std::vector< QuickGUI::TextSegment > segments;
segments.push_back( QuickGUI::TextSegment("text") );
widget->setText(segments);

Now I want to use this:
segments.push_back( QuickGUI::TextSegment(widget->getDefaultFont(), widget->getDefaultColor(), text) ); but getDefaultFont seems to return "". I defined the default font here:
Label HUD_Ammo
{
DefaultColor 1 0 0 1
DefaultFontName micross.16
Dimensions 450 15 120 25
Dragable false
Enabled true
HorizontalTextAlignment TEXT_ALIGNMENT_HORIZONTAL_LEFT
RelativeOpacity 0
SkinType default
Visible true

Text segments
{
Segment0 micross.16 1 0 0 1 Ammo:
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Any idea why it doesn't return the given font?

kungfoomasta

02-10-2009 05:29:35

Looking at TextUserDesc::serialize, it seems the property name is "DefaultFont", not "DefaultFontName" like you have.

Regarding your request to add more info to the mouse event args, I agree this is a good idea. I'll create an enum and populate it appropriately, there seem to be 4 mouse events: Button Down, Button Up, Move, Scroll.

I'm not really sure what your issue is with setting the text, I don't believe its related to QuickGUI. If you run the PlayPen app you can see I alter the label's text as you move the slider. I also change the test all the time in my game, I haven't seen any crashes related to this.

For the anchoring issue, is this only happening when you load from the script you gave me? What happens if you implement this setup in code? I'm super busy for the next 4 days or so, so I haven't been making additions to the code base as much as I'd like. :(

AndiNo

02-10-2009 11:38:05

Looking at TextUserDesc::serialize, it seems the property name is "DefaultFont", not "DefaultFontName" like you have.You are right... but this isn't very intuitive, since I copied that property over from a TextBox and there the property has the name DefaultFontName. Maybe you can make them the same so it's more straightforward?

I think these "mouse types" should cover everything, thanks!

As for the text, I tried this:
QuickGUI::ButtonDesc *bd = QuickGUI::DescManager::getSingleton().getDefaultButtonDesc();
bd->widget_dimensions.size = QuickGUI::Size(270, 65);
bd->widget_dimensions.position = QuickGUI::Point(50, 100);
bd->widget_dragable = false;
bd->textDesc.segments.push_back(QuickGUI::TextSegment("micross.20", QuickGUI::ColourValue::Red, "SINGLEPLAYER"));
bd->widget_horizontalAnchor = QuickGUI::ANCHOR_HORIZONTAL_CENTER;
QuickGUI::Button *clientBtn = mySheet->createButton(bd);

With the same behaviour. Only after I add this it works (ie after the widget has been created):
clientBtn->setHorizontalAnchor(QuickGUI::ANCHOR_HORIZONTAL_CENTER);
It's no problem if you have no time, this isn't urgent in any way :) Anyway thanks for your great support!

kungfoomasta

02-10-2009 16:50:39

You are right... but this isn't very intuitive, since I copied that property over from a TextBox and there the property has the name DefaultFontName. Maybe you can make them the same so it's more straightforward?

Good call, I've fixed it to be consistent, its now "DefaultFontName" to match TextBox.

I believe the anchoring is fixed now, (its all in SVN) sorry for so much troubles with it. I haven't used the centering anchor much, as you might have guessed. :)

AndiNo

02-10-2009 20:27:27

This is however (as you might have guessed :P ) one of the most used features by me :-D I can't understand why you wouldn't make use of it :-P
Anyway, thanks for your help, it works like a charm!

edit: Sorry for keeping you busy all the time, but I have another problem. My TextBox seems to ignore everything related to alignment :( Anchors are some sort of troublemakers aren't they?
TextBox Main_Multi_edit_IP
{
DefaultColor 1 0 0 1
DefaultFontName micross.16
Detectable true
Dimensions 200 150 150 25
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
HorizontalTextAlignment TEXT_ALIGNMENT_HORIZONTAL_LEFT
InheritOpacity false
MaxCharacters 255
RelativeOpacity 1
SkinType default
TextCursorDefaultSkinTypeName default
TransparencyPicking true
VerticalAlignment TEXT_ALIGNMENT_VERTICAL_CENTER
VerticalAnchor ANCHOR_VERTICAL_TOP
Visible true

UserDefinedHandlers WidgetEvents
{
}

Text segments
{
Segment0 micross.16 1 0 0 1 127.0.0.1
}
}

Neither the widget alignment nor the text-alignment seem to have any effect. Can you reproduce that or am I doing something wrong?

edit2: When I click on a TextBox its cursor appears, but when I set visible to false on that TextBox (by clicking on another button) the cursor remains there.

kungfoomasta

05-10-2009 19:28:59

Sorry for the delay, I had a mini vacation I was on, and no connection to internet. I hope to give a better response later today. (most likely I'll repro/fix the issues outlined :) )

kungfoomasta

06-10-2009 05:44:42

Doh! The API that honors the anchoring was overridden by both the TextBox and TextArea widgets. I've fixed them both now, anchoring works for them.

About the TextBox Cursor not disappearing, I cannot reproduce this, can you give me code, or pseudo code? I've created a Button that calls mTextBox->setVisible(false), the cursor disappears. I've also placed the TextBox on a window and toggled window visibility, cursor still disappears.

AndiNo

06-10-2009 13:58:42

Thanks for the fix :)
I used this sheet file to generate to GUI:
Sheet Tubbyhunt
{
BaseColor 1 1 1 1
BrushFilterMode BRUSHFILTER_LINEAR
ClipChildrenToDimensions true
ClipComponentsToDimensions true
ConsumeKeyboardEvents false
ContextMenuName
Detectable false
Dimensions 0 0 800 600
DisabledSkinType
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_LEFT_RIGHT
HorzBarScrollPercent 0.2
HorzButtonScrollPercent 0.1
HoverTime 3
InheritOpacity true
MaxSize 0 0
MinSize 5 5
MoveBaseWidgetOnDrag false
PositionRelativeToParentClientDimensions true
RelativeOpacity 1
ResizeFromBottom false
ResizeFromLeft false
ResizeFromRight false
ResizeFromTop false
ScrollBarThickness 15
Scrollable true
SkinType default
SupportScrolling true
TransparencyPicking true
VertBarScrollPercent 0.2
VertButtonScrollPercent 0.1
VerticalAnchor ANCHOR_VERTICAL_TOP_BOTTOM
Visible true
XScrollOffset 0
YScrollOffset 0

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
Panel Main_Main
{
Dimensions 0 0 800 600
Dragable false
Enabled true
RelativeOpacity 0
SkinType default
Visible true

Child Widgets
{
Button Main_Singleplayer
{
Dimensions 50 100 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER_DYNAMIC
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 SINGLEPLAYER
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Button Main_Multiplayer
{
Dimensions 50 250 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 MULTIPLAYER
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Button Main_Exit
{
Dimensions 50 400 270 65
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.20 1 0 0 0 EXIT
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

}
}

Panel Main_Multi
{
Dimensions 0 0 800 600
Dragable false
Enabled true
RelativeOpacity 0
SkinType default
Visible false

Child Widgets
{
Button Main_Multi_connectToServer
{
Dimensions 50 200 200 45
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.16 1 0 0 1 Connect to server
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Button Main_Multi_startAsServer
{
Dimensions 50 300 200 45
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.16 1 0 0 1 Start as server
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

TextBox Main_Multi_edit_IP
{
CursorBlinkTime 0.5
DefaultColor 1 0 0 1
DefaultFontName micross.16
Detectable true
Dimensions 200 150 150 25
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
HorizontalTextAlignment TEXT_ALIGNMENT_HORIZONTAL_LEFT
InheritOpacity false
MaxCharacters 255
RelativeOpacity 1
SkinType default
TextCursorDefaultSkinTypeName default
TransparencyPicking true
VerticalAlignment TEXT_ALIGNMENT_VERTICAL_CENTER
VerticalAnchor ANCHOR_VERTICAL_TOP
Visible true

UserDefinedHandlers WidgetEvents
{
}

Text segments
{
Segment0 micross.16 1 0 0 1 127.0.0.1
}
}

Button Main_Multi_Back
{
Dimensions 50 400 90 25
Detectable true
Dragable false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
RelativeOpacity 1
SkinType default
Visible true

Text segments
{
Segment0 micross.12 1 0 0 0 Back
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}
}
}

Panel HUD_Statusbar
{
Dimensions 0 550 800 50
Dragable false
Enabled true
RelativeOpacity 1
SkinType default
Visible false

Child Widgets
{
Label HUD_Health
{
DefaultColor 1 0 0 1
DefaultFontName micross.16
Dimensions 100 15 120 25
Dragable false
Enabled true
HorizontalTextAlignment TEXT_ALIGNMENT_HORIZONTAL_LEFT
RelativeOpacity 0
SkinType default
Visible true

Text segments
{
Segment0 micross.16 1 0 0 1 Health:
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}

Label HUD_Ammo
{
DefaultColor 1 0 0 1
DefaultFontName micross.16
Dimensions 450 15 120 25
Dragable false
Enabled true
HorizontalTextAlignment TEXT_ALIGNMENT_HORIZONTAL_LEFT
RelativeOpacity 0
SkinType default
Visible true

Text segments
{
Segment0 micross.16 1 0 0 1 Ammo:
}

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
}
}
}
}

Image HUD_Crosshair
{
BaseColor 1 1 1 1
BrushFilterMode BRUSHFILTER_LINEAR
ConsumeKeyboardEvents false
ContextMenuName
Detectable true
Dimensions 386 286 28 28
DisabledSkinType
Dragable false
DrawBackgroundLast false
Enabled true
HorizontalAnchor ANCHOR_HORIZONTAL_CENTER
HoverTime 3
ImageName crosshair.png
InheritOpacity true
MaxSize 0 0
MinSize 5 5
MoveBaseWidgetOnDrag false
PositionRelativeToParentClientDimensions true
RelativeOpacity 1
ResizeFromBottom false
ResizeFromLeft false
ResizeFromRight false
ResizeFromTop false
RotationInDegrees 0
Scrollable true
SkinType default
TileImage false
TransparencyPicking false
UpdateEveryFrame false
VerticalAnchor ANCHOR_VERTICAL_CENTER
Visible true

UserDefinedHandlers WidgetEvents
{
}

}
}

}

I applied scripts to the buttons, so what happens in my program is this:
1. I click on "MULTIPLAYER", the panel "Main_Main" is set to invisible and "Main_Multi" is set to visible.
2. I click on the textbox "Main_Multi_edit_IP" and the cursor appears.
3. I click on "Main_Multi_Back" and "Main_Main" appears again and "Main_Multi" disappears, however the textbox's cursor is still there and blinking.

btw: I use a function which is called from script which sets a widget to either visible or invisible. Is there a way to use a Widget pointer and set the visible property on it? I know it's private and only usable in subclasses, but in my case I would have to write a specific function for every possible widget class in order to set visibility on any widget...

kungfoomasta

06-10-2009 20:46:09

Ah, I realized the issue when reading your post, thanks. Its fixed in SVN now.

This weekend I will try to implement the serialization changes we talked about. Fortunately it won't be breaking changes for you, it just means you won't have to explicitly specify properties that have default values. It will take some work so I'm not likely to develop it any sooner. :P

AndiNo

07-10-2009 00:06:39

Thanks, I will try it out! And good luck with your development, this will be handy! :)
Oh and please, could you fix some of the "non virtual destructor" warnings I told you about? ;)

kungfoomasta

07-10-2009 19:13:59

I've addressed all the warnings, its checked into SVN now. Let me know if you find any others.

AndiNo

07-10-2009 20:15:40

No more warnings when compiling my app, thank you very much! :D There are only a few left, I will post them but I'm completely fine with how it is now.

The anchoring now works again, however there's one thing left^^ Here's how I create a textbox:
QuickGUI::TextBoxDesc *tbd = QuickGUI::DescManager::getSingleton().getDefaultTextBoxDesc();
tbd->widget_name = "edit_IP";
tbd->widget_dimensions.size = QuickGUI::Size(150, 125);
tbd->widget_dimensions.position = QuickGUI::Point(200, 50);
tbd->widget_dragable = false;
tbd->textbox_defaultColor = QuickGUI::ColourValue::Red;
tbd->textbox_defaultFontName = "micross.12";
tbd->textDesc.horizontalTextAlignment = QuickGUI::TEXT_ALIGNMENT_HORIZONTAL_CENTER;
tbd->textDesc.verticalTextAlignment = QuickGUI::TEXT_ALIGNMENT_VERTICAL_CENTER;
tbd->textDesc.segments.push_back(QuickGUI::TextSegment("micross.12", QuickGUI::ColourValue::Red, "127.0.0.1"));
QuickGUI::TextBox *editBox = mySheet->createTextBox(tbd);
// editBox->setHorizontalTextAlignment( QuickGUI::TEXT_ALIGNMENT_HORIZONTAL_CENTER );
// editBox->setVerticalTextAlignment( QuickGUI::TEXT_ALIGNMENT_VERTICAL_CENTER );

Text alignment only works if I use the commented out functions, not with the above. In the same way, text alignment defined by sheet file seems to have no effect, too. I'm never sure if maybe I did something wrong, so I'm not proposing it's a bug ;)

kungfoomasta

07-10-2009 20:35:27

It was a bug, I didn't honor the alignment in the widget's _init function. Thanks for raising all these bugs! :)

Also, the TextBox looks a little funky when I load it up, with a huge cursor and tiny font. Keep in mind the Text Cursor will always be the height of the text area within the textbox, so you might want to make the font bigger.

AndiNo

08-10-2009 11:27:37

I'm thanking YOU for fixing all these bugs :)
Yes I will change that, but it was easier like that to see the alignment behaviour.

kungfoomasta

12-10-2009 02:46:56

I didn't get around to making the serialization changes I wanted to, but I wanted to give you a heads up, the MouseCursor class is no longer publicly accessible, and the MouseCursor properties are tied to the Sheet widget. (Set the MouseCursor properties via the Sheet class)

The Sheet now has the following script properties:

MouseCursorEnabled
MouseCursorSkinType
MouseCursorVisible


If I had implemented the default property values, you may not notice these changes, but until then, the cursor 'could' be disabled or invisible or have no skin by default. Please add these properties to your script files. I plan to implement the serialization enhancements in the next 48 hours or so.

AndiNo

12-10-2009 11:09:16

Thanks for the info, it'll be useful! I'll follow your updates here, keep up the good work! :)

kungfoomasta

14-10-2009 21:41:59

Ok its implemented in SVN! I have only done basic sanity testing, and as this feature required many core changes, its possible there are a few bugs to be ironed out.

Please let me know if you find any.

[Edit]
I've renamed Text properties:

Text.AllottedSize
Text.HorizontalAlignment
Text.Offset
Text.BrushFilterMode
Text.VerticalLineSpacing
Text.VerticalAlignment

I figure I might as well make some changes for the better even if they're breaking changes, since I already have a few breaking changes. Better to do it all from 9.09 to 9.10 than to do breaking changes every update. :)
[/Edit]

AndiNo

14-10-2009 22:08:49

Sounds cool! However it will take some time before I can test the new features as I currently have to work on some features of my game. After that I'll be happy to lend you a (testing) hand ;)