Reaction objects Layout

12 posts / 0 new
Last post
AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
Reaction objects Layout

Hello everyone,

having the code to open a reaction window, i want to create a nice layout with few objects as follow:

one frame with a label (mylabel) and another label inside the frame (myDescriptionLabel):

IMAGE(http://img62.imageshack.us/img62/6513/framecr.png)

1) How to put my description label inside the frame?

at the bottom, i want to create a second frame add a label and a string object inside the frame.

2) How to tell to reaction that the last frame and its objects should be positioned at the botton?

Thank you vewry much

trixie
trixie's picture
Offline
Last seen: 5 months 2 weeks ago
Joined: 2011-02-03 13:58
Re: Reaction objects Layout

1. Use a vertical layout object for your WINDOW_Layout.
2. LAYOUT_AddChild a layout object with LAYOUT_BevelStyle, BVS_GROUP and LAYOUT_Label, "First Frame"
3. Inside this layout, LAYOUT_AddImage a label image object with the "bla bla" text.
4. End the layout.
5. LAYOUT_AddChild another layout object with LAYOUT_BevelStyle, BVS_GROUP and LAYOUT_Label, "Second Frame".
6. Inside this layout, LAYOUT_AddChild the string gadget.
7. End the layout.

The layout hierarchy will be like this:

-parent layout (level 1)
--child layout (level 2)
---child label image (level 3)
--child layout (level 2)
---child string gadget (level 3)

Object positioning in ReAction depends on their placement in the layout hierarchy. If the second framed layout is placed after the first one and the parent layout is vertical, the second layout will be positioned at the bottom of the window.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
Could you, please, add an

Could you, please, add an example code?

Thank you

trixie
trixie's picture
Offline
Last seen: 5 months 2 weeks ago
Joined: 2011-02-03 13:58
Re: Reaction objects Layout

Do something like this:

  1. ...
  2.  
  3. WINDOW_Layout, IIntuition->NewObject(LayoutClass, NULL,
  4. LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
  5. LAYOUT_SpaceOuter, TRUE,
  6. LAYOUT_DeferLayout, TRUE,
  7.  
  8. LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL,
  9. LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
  10. LAYOUT_BevelStyle, BVS_GROUP,
  11. LAYOUT_Label, "First Frame"
  12. LAYOUT_AddImage, IIntuition->NewObject(LabelClass, NULL,
  13. LABEL_Text, "Bla bla bla",
  14. TAG_END), // end of the label object
  15. TAG_END), // end of the layout object
  16.  
  17. LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL,
  18. LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
  19. LAYOUT_BevelStyle, BVS_GROUP,
  20. LAYOUT_Label, "Second Frame"
  21. LAYOUT_AddChild, IIntuition->NewObject(StringClass, NULL,
  22. GA_RelVerify, TRUE,
  23. TAG_END), // end of the string object
  24. CHILD_Label, IIntuition->NewObject(LabelClass, NULL, LABEL_Text, "Type text Here:", TAG_END),
  25. TAG_END), // end of the layout object
  26.  
  27. TAG_END), // end of the parent layout object
  28.  
  29. ...

Note that the example code expects that you have obtained the relevant class pointers (LayoutClass, LabelClass, StringClass) before, via OpenClass(). See this tutorial, section 4.2 to learn how to do it.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

salass00
salass00's picture
Offline
Last seen: 5 months 4 days ago
Joined: 2011-02-03 11:27
I uploaded a complete,

I uploaded a complete, compilable example here:
http://dl.dropbox.com/u/26599983/ra_layout_example.7z

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
Thank you both. I will try

Thank you both.

I will try as soon as possible.

Another things i wants to do is:

make the description label on first frame changeable when write something on the StrinObject.
I assume that the label should have a name (or ID) and i have to use SetAttr....

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
Sorry, double post.

Sorry, double post.

trixie
trixie's picture
Offline
Last seen: 5 months 2 weeks ago
Joined: 2011-02-03 13:58
Re: Reaction objects Layout

Another things i wants to do is:

make the description label on first frame changeable when write something on the StrinObject.


In that case, don't LAYOUT_AddImage a label object. Instead, LAYOUT_AddChild a button gadget (or a texteditor gadget, if the string text can get long) object and make it read-only by passing GA_ReadOnly, TRUE.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
This is what my code looks,

This is what my code looks, so far

  1. WINDOW_ParentGroup, VGroupObject,
  2. LAYOUT_AddChild, VLayoutObject,
  3. LAYOUT_SpaceOuter, TRUE,
  4. LAYOUT_BevelStyle, BVS_GROUP,
  5. LAYOUT_Label, "Welcome",
  6. LAYOUT_AddChild, StringObject,
  7. GA_ID, GID_STRING1,
  8. GA_RelVerify, TRUE,
  9. GA_TabCycle, TRUE,
  10. STRINGA_MinVisible, 20,
  11. STRINGA_MaxChars, SMAX,
  12. EndObject,
  13. CHILD_Label, LabelObject, LABEL_Text, "Type Text here:",
  14. End,
  15. End,
  16. LAYOUT_AddChild, HLayoutObject,
  17. LAYOUT_SpaceOuter, TRUE,
  18. LAYOUT_BevelStyle, BVS_GROUP,
  19.  
  20. EndHGroup,
  21. EndVGroup,
  22. EndWindow))/code]
  23.  
  24. It's good or something is wrong?
trixie
trixie's picture
Offline
Last seen: 5 months 2 weeks ago
Joined: 2011-02-03 13:58
Re: Reaction objects Layout

@AmigaBlitter

The structure looks fine to me - but it won't do exactly what you describe in your first post :-)

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
@Trixie In the first post is

@Trixie

In the first post is that i want to achieve, while the structure i posted later is one of my some attemps. I'm a little confused by the many methods to do things in OS4. I want to focus on Reaction only, without using Macros (as you seggested).

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2012-02-18 19:55
@trixie PM for

@trixie

PM for you

@siteadmin
can pm messages be put in a more visible zone?
thank you

Log in or register to post comments