New to Reaction

10 posts / 0 new
Last post
dbstastny
dbstastny's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 2017-02-04 00:01
New to Reaction
New to reaction programming and I am having a bit of trouble understanding a couple concepts. One thing I am trying to do is completely control positioning of gadgets utilizing LAYOUT_NoLayout 1. Without using GIMMIEZEROZERO on the window attribute how do you get the proper metrics for the borders and other gadgets? 2. The label image class. How do you control the size and position of label in a layout if you are using so you have manual control over placement like you can with gadgets. Hopefully some of you can point me in right direction. I have been reading all the articles here and have gleaned much but I am really trying to wrap my head around some of the conceptual differences from other GUI APIs. ie. no child windows, labels are not gadgets etc... Thanks Doug
LyleHaze
LyleHaze's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-26 03:58
Re: New to Reaction
Welcome! You have chosen a challenge. As I understand it, ReAction is all about managing the GUI in a "standard" way so the programmer does not have to. It can get a bit tricky, but choosing "complete control of position" is going to be a wrestling match at best. Back in the pre-reaction days, programmers had complete control over the GUI, and all those gadgets and such are still available. Reading any early AmigaDOS Intuition references would be the quickest way to get there. As far as ReAction goes, there were some early macros that have since been deprecated. One unfortunate result is that a lot of the examples out there are not as useful, nor as clear as they ought to be. Trixie took a trip through all of this, and wrote a really excellent guide to ReAction programming. It is hosted on this site, titled "Beginner's Guide to Programming ReAction". It is the best reference on what to do, and what to avoid doing, that I have seen yet. I am no expert, but I started by absorbing as much from his guide as I could, and I continue to add to my abilities as need arises. Good Luck! LyleHaze
LyleHaze
jabirulo
jabirulo's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2013-05-30 00:53
Re: New to Reaction
What kind of (ReAction) GUI have you in mind to create? Maybe you can post here a sketch of your GUI designed or part of code. I will suggest start with http://www.os4depot.net/share/development/example/reaction_examples.lha and with http://www.os4depot.net/share/development/example/reaction_dn.lha and as LyleHaze http://www.os4depot.net/share/document/development/reactionguide.lha There are some small programs I made on os4depot that have sources and you can see the GUI/Reaction code (POff, DateTime, KeymapSwitcher,...) and maybe inside the SDK there are other examples.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
dbstastny
dbstastny's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 2017-02-04 00:01
Re: New to Reaction
Hi, Thanks for feedback been reading through all those documents but non really document enough of behaviors and interactions of the various options. The UI is not a specific design. I am working on porting a GUI API like (WxWidget but not that) to support the Amiga and trying to deal with the complexities of mapping the functionality of the generic API to Amiga Widgets. I was hoping to be able to use the high level constructs of Reaction with out having to dive deeper into intuition. The API wants to control alignment/layout hence my completely disabling the layout control. My challenge is understanding labels in unlike most other platforms they are a widget too. I can move gadgets around fine but not labels. Thanks Doug
DStastny
jabirulo
jabirulo's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2013-05-30 00:53
Re: New to Reaction
If you mean labels as the text that shows (normally) before the gadget (sorry for poor/ASCII art): Label [ @ | options ] Label: [string_gadget] Label [  x ] [ x ] Label You can "make" the label a button without bevel (BUTTON_BevelStyle,BVS_NONE) and transparency (BUTTON_Transparent,TRUE) so it looks like a normal label.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
dbstastny
dbstastny's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 2017-02-04 00:01
Re: New to Reaction
@jabirulo That is a great idea! Thank you
DStastny
broadblues
broadblues's picture
Offline
Last seen: 1 week 1 day ago
Joined: 2012-05-02 21:48
Re: New to Reaction
New to Reaction New to reaction programming and I am having a bit of trouble understanding a couple concepts. One thing I am trying to do is completely control positioning of gadgets utilizing LAYOUT_NoLayout
You probably shouldn't? The whole point of layout gadget is that is lays out stuff. Using LAYOUT_NoLayout is for extreme exceptions. I've used it exactly once in my SnakeEyes.py image view when I needed to place a bitmap image so it centred in the display window. I don't if this will give you a clue or not as it's python code , for my ProAction GUIServer, which is a fairly thin wrapper arround the underlying BOOPSI code.
  1. def RelayoutImage(guiKey):
  2. global layouts
  3. global needrefresh
  4. layouts += 1
  5. SetWindowBusy(guiKey,1)
  6.  
  7. # Get the various attributes we need
  8. (rc,rc2,bmWidth) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['bitmapImageID'] + " TAGNAME \"BITMAP_Width\"")
  9. (rc,rc2,bmHeight) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['bitmapImageID'] + " TAGNAME \"BITMAP_Height\"")
  10.  
  11. (rc,rc2,layWidth) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['imageLayoutID'] + " TAGNAME \"GA_Width\"")
  12. (rc,rc2,layHeight) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['imageLayoutID'] + " TAGNAME \"GA_Height\"")
  13. (rc,rc2,layTop) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['imageLayoutID'] + " TAGNAME \"GA_Top\"")
  14. (rc,rc2,layLeft) = SendGUICmd("GETATTR GUIID " + guiKey + " OBJECTID " + gadgets['imageLayoutID'] + " TAGNAME \"GA_Left\"")
  15.  
  16. # note at this point all the attributes are strings!
  17.  
  18. laspect = float(layWidth)/float(layHeight)
  19. baspect = float(bmWidth)/float(bmHeight)
  20.  
  21. if baspect > laspect:
  22. mwidth = int(layWidth)
  23. mheight = int(float(layWidth) / baspect)
  24. mleft = int(layLeft)
  25. mtop = int(layTop) + (int(layHeight) - mheight)/2
  26.  
  27. else:
  28. mheight = int(layHeight)
  29. mwidth = int(float(layHeight) * baspect)
  30. mleft = int(layLeft) + (int(layWidth) - mwidth) /2
  31. mtop = int(layTop)
  32.  
  33. # layout our bitmap manually
  34. bitmapSetTags = ""
  35. bitmapSetTags += "IA_Left," + str(mleft) + ","
  36. bitmapSetTags += "IA_Top," + str(mtop) + ","
  37. bitmapSetTags += "IA_Width," + str(mwidth) + ","
  38. bitmapSetTags += "IA_Height," + str(mheight) + ","
  39. bitmapSetTags += "TAG_DONE"
  40.  
  41. (rc,rc2,dummy) = SendGUICmd("SETATTRS GUIID " + guiKey + " OBJECTID " + gadgets['bitmapImageID'] + " TAGSTRING " + bitmapSetTags)
  42.  
  43. SetWindowBusy(guiKey, -1)
  44. needrefresh = 1
Notice I get the bounds of the parent layout by querying it's GA_Top/GA_Left/GA_height/GA_Width parameters, calculate the image parameters accordingly and set the IA_Left,IA_Top etc It works but is quite clunky and when I came to working on MultiViewer I used a custom image display gadget to disply the images using compositing or manual scaling. The full script is here: http://os4depot.net/index.php?function=showfile&file=graphics/viewer/snakeeyes.lha
broadblues
broadblues's picture
Offline
Last seen: 1 week 1 day ago
Joined: 2012-05-02 21:48
Re: New to Reaction
The UI is not a specific design. I am working on porting a GUI API like (WxWidget but not that) to support the Amiga and trying to deal with the complexities of mapping the functionality of the generic API to Amiga Widgets. I was hoping to be able to use the high level constructs of Reaction with out having to dive deeper into intuition. The API wants to control alignment/layout hence my completely disabling the layout control. My challenge is understanding labels in unlike most other platforms they are a widget too. I can move gadgets around fine but not labels.
Lables are BOOPIS objects just like Gadgets, but they are based in imageclass not gadgetclass. There is quite a lot in common between the two, but images don't accept input. Sounds to me like you may need to devise you own layout gadget if the standard one doesn't map well to the alien GUI. That will require lowlevl BOOPSI class coding and is ot a trivial undertaking for someone new the concepts. It doesn't that there is a fair amount of private stuff going on between window.class and the layout gadgets. You might need to drop window.class and use a plain Intuition window.
dbstastny
dbstastny's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 2017-02-04 00:01
Re: New to Reaction
Sounds to me like you may need to devise you own layout gadget if the standard one doesn't map well to the alien GUI. That will require lowlevl BOOPSI class coding and is ot a trivial undertaking for someone new the concepts.
I have considered this approach but as you point out that is bigger under taking. I am starting to consider not supporting the foreign GUI API and providing an Amiga specific implementation. I will work on getting my github repo up so you guys can see more clearly what I am attempting. Thanks for feedback Doug
DStastny
hypex
hypex's picture
Offline
Last seen: 16 hours 52 min ago
Joined: 2011-09-09 16:20
Re: New to Reaction
Hi dbstastny. Just wanted to add some comments. As belated as I am. :-) I tend to agree with LyleHaze here. If you need more control then Intuition is one way to go about it. As that will give you control over position and size. And also images which is useful. Which, if you wanted, could be used to customise your font rendering. But how much control do you need? Do you also need to render custom border images and fonts? Or can you leave it up to the GUI engine? If you wanted full control you could use Intuition. However, if all you really need is the ability to specify size and position, then you should consider GadTools. This uses the building blocks of Intuition to create the gadgets but simplifies the creation process and also generates a standard look. It doesn't layout for you but does allow you to specify position and size. You just need to calculate the width of any text inside so size fits. Which is easy enough. Under the shadow of ReAction, with no gadget auto layout, GadTools has been relegated to being a menu generator. Since it allows fairly simple menu generation. In fact, one thing it does layout is menus, so it left a funny legacy there. :-)
Log in or register to post comments