How to get the width and height of layout object

2 posts / 0 new
Last post
walkero
walkero's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2009-05-03 16:54
How to get the width and height of layout object

Hello guys. I am developing an app where I have a layout object with a CHILD which is a bitmap object. What I want to do is to read the current width and height of the layout object so that I can set the equivalent size of the bitmap.

I tried to use the IIntuition->GetAttrs but didn't work that good

  1. ULONG layoutres;
  2. int layoutwidth;
  3. layoutres = IIntuition->GetAttrs( objects[OID_LAYOUT_Pic],
  4. CHILD_MinWidth, &layoutwidth,
  5. TAG_DONE );
  6.  
  7. IDOS->Printf( "layout data! %ld", layoutwidth );

The above code returns something like
layout data! -2063585277

Do you have any clue on how to do that?

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
The above code returns

The above code returns something like

No, it doesn't. It returns nothing because CHILD_MinWidth is an attribute which can only be set, not get. The value of layoutwidth remains unchanged. What you print is the contents of an uninitialized variable.

Do you have any clue on how to do that?

Please describe what you want to do. Changing the size of a bitmap in your main program and then drawing it into the GUI is not the object oriented way one would use in a BOOPSI / ReAction environment. If you want to have a scalable bitmap inside a layout group which automatically adjusts its size according to the window size, you should make a small custom BOOPSI gadget which you add to the layout in place of the bitmap. The gadget's methods can then adjust the bitmap size and draw it inside its context and not "from the outside".

I can create an example for you tomorrow.

Log in or register to post comments