Custom widget in myGUI


16-04-2009 13:44:43


i would like to create my own widget: an image with multiline text togehter. Than i want to put these widgets into ItemBox. How to do this? Where can i get information about custom widgets? Can anyone help me?



16-04-2009 14:32:45

Demo_ItemBox items have Image with text on it. So it's same thing that you want.


16-04-2009 15:11:05

Thank you, i'll study this sample more carefully. But the question is still actual: how to create custom widgets?


16-04-2009 15:22:46

There's example of custom widget in Plugin_StrangeButton and Demo_PluginStrangeButton. But usually it's enough to use several widgets, I don't see any reasons for creating custom widgets.


16-04-2009 16:37:49

Thank you again.

One more question about ItemBox. I've found how to add text. But I cannot manage the way of text output. I want to have the following:

|--------|----------------------------------------- |
| the | Here is the text. It must be |
| Image | multiline and formatted (colored |
|is here | etc.) |

Can i do it without inheritance of ItemBox or any of its parts?



16-04-2009 16:43:18

I think it's impossible to do it (without ItemBox). Now we haven't any powerful text formatters.


16-04-2009 19:25:52

You should use Edit with WordWrapSimple skin or with WordWrap (this skin have with VScroll if text is bigger than area) for right widget.


17-04-2009 07:03:44

Altren, i see here two possibilities: the first one is to join 2 widgets (Edit and StaticImage) together and encapsulate them into new one. The second way is inheritance of the new widget from one of these widgets (i guess this must be the Edit) and add functionality to it. What is the right way?


17-04-2009 15:54:34

I don't see any good reasons to do both things that you suggested: you should look at ItemBox demo code: there's one _Main widget and all other is child widgets (three static Images and two Static Texts). Just make similar layout with _Main widget, one Static Image on the left and Edit on the right.


20-04-2009 10:38:47

"Custom widget? In [i]my [/i]GUI?"