English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 21 August 2023, 08:59   #1
deeveon
Registered User
 
Join Date: Feb 2023
Location: USA
Posts: 4
Need some help with iconification and newsize

I was an avid Amiga user back in the day, but sold all my hardware (still have some software though) long ago. I never learned how to code for it though, which I always wanted to do. Even bought SAS/C, but only used it for university class projects. So, I've dusted that off and am now starting to learn how to code for AmigaOS and have run into a couple of issues I am stuck on regarding how windows work.

Note: I'm using AmigaOS 3.2.2 running in WinUAE 5.0.0 (64-bit) and compiling my application with SAS/C 6.58.

Attached is the learning app I made where it opens the window, has all the expected window gadgets and mostly works just fine except RA_Iconify() and WMHI_NEWSIZE. I want to get those sorted before I move on to learning how to do menus, layouts, etc.

The issues:

1) RA_Iconify() always fails. I found several examples and followed those, but it still fails. Doesn't matter if I run from Workbench or CLI, RA_Iconify() always returns FALSE. System apps, such as a Shell window, iconfiy/uniconify fine, so the issue seems to be specific to my learning app.

2) When I resize the window, I don't get the WMHI_NEWSIZE message. Resizing triggers a signal, but when I go to fetch messages using RA_HandleInput(), there is only WMHI_LASTMSG. I don't see anything in the autodocs to indicate I have to do anything more than just add the size gadget to the window (unlike the depth gadget for example where you have to also specify WA_NotifyDepthto be notified of depth changes), so I don't understand why I'm not seeing the newsize messge.

I would greatly appreciate some help figuring out what I'm doing wrong as I've been trying to figure it out myself for a couple days now with no luck. Thanks!
Attached Files
File Type: c window.c (8.4 KB, 45 views)
deeveon is offline  
Old 21 August 2023, 09:33   #2
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,673
You need to call WA_IDCMP, IDCMP_NEWSIZE so that window.class can hear the size events. The AppPort is not being properly set up either which would explain why iconification doesn't work; that needs to be done earlier.
Minuous is offline  
Old 21 August 2023, 09:59   #3
deeveon
Registered User
 
Join Date: Feb 2023
Location: USA
Posts: 4
Quote:
Originally Posted by Minuous View Post
You need to call WA_IDCMP, IDCMP_NEWSIZE so that window.class can hear the size events. The AppPort is not being properly set up either which would explain why iconification doesn't work; that needs to be done earlier.
I added WA_IDCMP and that solved the newsize issue. Thanks!

I tried creating the AppPort at various times, even as the very first thing that main() does, and it still always fails. One of the last things I tried before posting was to try to create it after creating the window object and simply forgot to move it back before posting. In the attached, newsize works now, but iconification still always fails.
Attached Files
File Type: c window.c (8.4 KB, 26 views)
deeveon is offline  
Old 21 August 2023, 10:18   #4
deeveon
Registered User
 
Join Date: Feb 2023
Location: USA
Posts: 4
I figured out why iconification wasn't working. Novice C programmer mistake. I didn't have {} around the else statements, so done=TRUE was always getting executed. Doh!

Thanks for the help though, much appreciated!
deeveon is offline  
Old 21 August 2023, 12:34   #5
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,026
Your usage of winsig and appsig is not conformant. You should never peek into objects created or used by BOOPSI classes.

You should remove the appsig variable alltogether and to retreive winsig you should use
GetAttr(WINDOW_SigMask, winObj, &winsig);

You do that already, but immediately after you overwrite the value. That's not good.

As the window pointer may change after uniconify, you should move the GetAttr call inside the loop, just where you peek win->UserPort now.

The WINDOW_SigMask attribute includes the AppPort signal, so you don't need to take care of it.

The pointer you get from WM_OPEN and WM_UNICONIFY should be considered a black box. Do not access it. Just store it and forward it to RefreshGList and other functions where a window pointer is required.
thomas is offline  
Old 22 August 2023, 13:19   #6
deeveon
Registered User
 
Join Date: Feb 2023
Location: USA
Posts: 4
Thanks Thomas. I appreciate the additional information and guidance.
deeveon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:51.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06885 seconds with 12 queries