07 February 2024, 04:20 | #1 |
Registered User
Join Date: Jul 2022
Location: Australia
Posts: 49
|
Best way to implement dynamic resizing of gadgets/windows
Hi all!
If you've followed my previous threads, you'll know I'm writing a Reaction app in assembler. So far I've managed to workaround, or figure out all my issues, however I've got a question I'd like to throw out there. My app contains a button gadget (Reaction class) that renders an image in it (it's actually the image from an arbitrary .info file, so an icon). It renders fine; all good. However, sometimes the icon's width/height exceed the size of the button gadget and it's rendered outside the bounds, resizing the window to make it bigger fixes this. How should I best handle this scenario? 1. Detect that the gadget is too small and issue ChangeWindowBox() to scale the window by some factor; or 2. just scale the image so it fits in the gadget. The layout class is a little primitive I feel, at least I haven't figured out a way that would have the gadget auto-resized (I've tried calling SetGadgetAttrs to modify the dimensions of the button, but the layout itself prevents it from resizing). Appreciate any feedback folks may have on this! Cheers, -Matt I've attached screenshots showing what I'm talking about! Last edited by Mafi; 07 February 2024 at 06:40. |
07 February 2024, 07:23 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,043
|
You use SetAttrs() to tell the button about the new GA_Image and then call WM_RETHINK on the window object. The window will resize itself if required.
|
07 February 2024, 07:38 | #3 |
Registered User
Join Date: Jul 2022
Location: Australia
Posts: 49
|
Thanks Thomas - will try this when I get home!
|
07 February 2024, 08:21 | #4 |
Registered User
Join Date: Jul 2022
Location: Australia
Posts: 49
|
Ok, I used SetAttrsA to update GA_Image (this works) of the button; but sending WM_RETHINK to the window object doesn't appear to do anything
-M |
07 February 2024, 13:58 | #5 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,043
|
Check out this example. It does almost the same as your program.
First argument is path to directory with pictures. |
07 February 2024, 22:43 | #6 |
Registered User
Join Date: Jul 2022
Location: Australia
Posts: 49
|
Thanks Thomas, yes this is what I had in mind. The only difference I can see is that in your code GA_Image is a pointer to a bitmap class object whereas mine is a pointer to the bitmap at do_Gadget->gg_GadgetRender. I wouldn’t have thought that would matter though?
|
08 February 2024, 16:24 | #7 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,043
|
Well, I changed the example to use icons rather than bitmaps and it still works for me.
|
09 February 2024, 21:38 | #8 | |
Registered User
Join Date: Jul 2022
Location: Australia
Posts: 49
|
Quote:
Thanks again. -M |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I implement locks? | Sim085 | Coders. C/C++ | 2 | 28 October 2022 00:07 |
AGA Palette... how to implement | Steve | Coders. Asm / Hardware | 23 | 25 November 2018 22:26 |
implement others 68000 machines ? | turrican3 | support.WinUAE | 28 | 23 November 2017 00:54 |
[REQUEST] implement Windows variables paths | hexaae | support.WinUAE | 4 | 28 June 2016 21:40 |
Resizing windows wont save using ClassicWB_ADVSP | kipper2k | project.ClassicWB | 7 | 14 March 2009 00:23 |
|
|