Reaction GUI and vertical layouts

9 posts / 0 new
Last post
Hans
Hans's picture
Offline
Last seen: 4 months 4 weeks ago
Joined: 2010-12-09 22:04
Reaction GUI and vertical layouts

I'm working on a small GUI, and I want to have a vertical fuel-gauge gadget with a 2-line label centred above it. This sounds like it should be simple, but I just cannot get it aligned right.

Here are the problems I have encountered so far:
- The layout gadget only allows labels to be to the left or right of gadgets, so putting labels above or below a gadget isn't natively supported
- The documentation suggests using the layout gadget's own label field, but it doesn't support multi-line labels. Putting a '\n' in it, results in an ugly box being printed instead of starting a new line
- I cannot use a string gadget, because it doesn't provide full control over its border style
- I tried using a read-only button gadget, but it also doesn't support multi-line labels
- I also tried just adding a label.image object (which does support multi-line labels) to the layout, but that simply isn't rendered
- I have had the best success by putting a label.image inside a read-only button gadget, but the label is shifted 5 pixels or so to the right

So, what would be the best way of getting a properly centred multi-line label above a fuelgauge gadget (or any other gadget type)? It seems like I really need to jump through hoops to get things to look the way that I want them to.

Hans

salass00
salass00's picture
Offline
Last seen: 2 weeks 4 days ago
Joined: 2011-02-03 11:27
- I also tried just adding a


- I also tried just adding a label.image object (which does support multi-line labels) to the layout, but that simply isn't rendered

Did you use LAYOUT_AddImage or LAYOUT_AddChild to this? LAYOUT_AddChild won't work as label.image is a subclass of imageclass and not gadgetclass.

thomas
thomas's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 2011-05-16 14:23
and the layout should

and the layout should recognize internally whether it's a gadget or an image

How?

salass00
salass00's picture
Offline
Last seen: 2 weeks 4 days ago
Joined: 2011-02-03 11:27
and the layout should



and the layout should recognize internally whether it's a gadget or an image

How?

An OM_GET attribute could be added in gadgetclass, imageclass and datatypeclass that returns an appropriate value in each case.

Edit: This wouldn't work with non-BOOPSI gadgets and images though, but existing tags could always be used for those cases. An idea might be to rename current LAYOUT_AddChild to LAYOUT_AddGadget and add a new tag LAYOUT_AddChild tag that only works with BOOPSI objects.

Log in or register to post comments