Intuition simple menu example

35 posts / 0 new
Last post
AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-18 19:55
My fault, sorry. I promise i

My fault, sorry.

I promise i will study.

I've managed to add the second window. Now i have to add menus and events for the second window :P

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-18 19:55
What's next? after learning

What's next?

after learning the basic of windowing, i would like to learn how to attach text to those windows @ any pos (x,y). Yes, there are examples here and there, but these exemples are, as usual, done for the old programming methods.

thomas
thomas's picture
Offline
Last seen: 10 hours 48 min ago
Joined: 2011-05-16 14:23
You cannot use specific

You cannot use specific coordinates in a ReAction GUI. The GUI is built completely dynamically. It is organised in horizontal and vertical groups and the size of each group is derived from the objects it contains and from the window size. The size of each object is dynamically calculated from its kind and the size of its neighbours and its parents.

If you print your text at fixed coordinates, it is very likely that you print over an existing object.

That said, if you look at the toolbar example, you will find an empty horizontal group between the toolbar and group containing the ok/cancel buttons.

If you put this between StartHGroup and EndHGroup, it will print some text into the empty space:

  1. LAYOUT_AddImage,LabelObject,
  2. LABEL_Text,"Hello World!",
  3. EndObject,
AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-18 19:55
Is this a limit or a good

Is this a limit or a good functionality?

I saw somewhere some example where you simply wirte:

  1. rp = win->RPort;
  2. Move (rp,20,40);
  3. Text (rp,"Beep !",6); /* you won't see DisplayBeep on a RTG screen */

Again, there are different way to do things on AOS, but it's a lot confusing.

Assuming i want to show a moving text using reaction and (let me use this term) using the "last shout" on AOS programming.... the code above would not be portable to reaction?

In the scrwin.c you provide this nice function;

  1. struct Window *open_window (struct Screen *scr,const char *title,long x,long y,long w,long h,struct NewMenu *newmenu,struct VisualInfo *vi,struct Menu **menuptr)
  2.  
  3. {
  4. struct Menu *menu = NULL;
  5. struct Window *win;
  6.  
  7. if ((win = OpenWindowTags (NULL,
  8. WA_CustomScreen,scr,
  9. WA_Title,title,
  10. WA_Left,x,
  11. WA_Top,y,
  12. WA_Width,w,
  13. WA_Height,h,
  14. WA_Flags,WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM | WFLG_ACTIVATE | WFLG_NEWLOOKMENUS | WFLG_NOCAREREFRESH,
  15. WA_IDCMP,IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY | IDCMP_MENUPICK,
  16. WA_MaxWidth,scr->Width,
  17. WA_MaxHeight,scr->Height,
  18. TAG_END)))
  19. {
  20. if (vi)
  21. if (menu = CreateMenusA (newmenu,NULL))
  22. if (LayoutMenus (menu,vi,GTMN_NewLookMenus,TRUE,TAG_END))
  23. SetMenuStrip (win,menu);
  24. }
  25.  
  26. *menuptr = menu;
  27. return (win);
  28. }

I assume that the function should return an object instead of a window structure. How would this function looks like in the reaction version?

Pages

Log in or register to post comments