ReAction: Is it possible...

3 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2010-11-30 14:09
ReAction: Is it possible...

Say, I have a window containing some boxes (layouts with visible border) and in one of those boxes there is a getfile.gadget present.

Is it possible to traverse an entire layout (outer layer is a window) and retrieve all gadgets (and layouts and images etc.) one by one?

Is it possible to find out whether a given gadgetobject is a getfile.gadget by comparing some field in the object's underlaying struct with getfile.gadget's base as retrieved by IIntuition->OpenClass()?

Is it possible to find the first occurrence of layout.gadget that surrounds a getfile.gadget (first occurrence encountered when working from the getfile.gadget 'outwards')?

What I am up to?

Well, if I want a window to be an appwindow then I somehow want to draw a file onto that window (and an appropriate dropboxzone) and it can be taken for granted that that window contains a getfile.gadget.
I want to 'automate' things a bit. When a window contains a getfile.gadget, I want that window to turn into an AppWindow automatically and the (beveled) box (layout) around that gadget acting as its dropzone.

Seems simple enough, no?

OldFart

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
Re: ReAction: Is it possible...

Is it possible to traverse an entire layout (outer layer is a window) and retrieve all gadgets (and layouts and images etc.) one by one?

You think in the wrong way. You have to think object oriented. There is not a big list of gadgets in the window you can traverse. There is only one single gadget in the window which covers the entire window body. Only by chance this gadget is of class layout.gadget. This class maintains its own (private!) list of members. But again this is not a hierachical list of all members you could traverse. Layout.class only maintains a linear list of its primary members. Only by chance one or more of these members are of class layout.gadget again and all these members maintain their own private liniar list of their members.

I want to 'automate' things a bit. When a window contains a getfile.gadget, I want that window to turn into an AppWindow automatically and the (beveled) box (layout) around that gadget acting as its dropzone.

The proper way to achieve this in an object oriented environment would be to create a sub-class of layout.gadget which is then for example dropzone.gadget. When you design your GUI you use this dropzone.gadget class to surround your getfile.gadget so that it becomes the drop zone. All other areas of the window would be normal layout.class objects.

The difficulty will be to find the right point in time when to create and remove the drop zone. You'll probably have to implement new methods which you call whenever the window has been opened resp. will be closed/iconified.

broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Re: ReAction: Is it possible...

Sounds a little like you might want to apply this retroactively to windows like some kind of commodity, this would be impossible.

If it's your own window you can of course save pointers to the layouts containg the getfile gadget as you build the GUI and then once the window is open create a dropzone by getting the layouts size andcoords with GetAttrs(layoutobj,GA_Top,&top, .... TAG_DONE)

Also remeber that the filerequester that pops up from the getfile is an app window so you can open that and drop a file on it already.

Log in or register to post comments