For testing purposes i do need a window that should be resizable and when resized should print out the new dimensions, say on clicking the mouse.
I used
tags[c].ti_Tag = WA_SizeGadget; tags[c].ti_Data = TRUE; ++c; tags[c].ti_Tag = WA_CloseGadget; tags[c].ti_Data = TRUE; ++c; tags[c].ti_Tag = WA_IDCMP; tags[c].ti_Data = IDCMP_CLOSEWINDOW | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE ; ++c
and the ReplyMsg code looks like
BOOL handleIDCMP(struct Window *win, BOOL done) { struct IntuiMessage *message; USHORT code; SHORT mousex, mousey; ULONG class; while (NULL != (message = (struct IntuiMessage *)GetMsg(win->UserPort))) { class = message->Class; code = message->Code; mousex = message->MouseX; mousey = message->MouseY; ReplyMsg((struct Message *)message); /* The class contains the IDCMP type of the message. */ switch (class) { case IDCMP_CLOSEWINDOW: done = TRUE; break; case IDCMP_NEWSIZE: break; case IDCMP_MOUSEBUTTONS: switch (code) { case SELECTUP: getdimensions(); break; default: printf("UNKNOWN CODE\n"); break; } break; default: printf("Unknown IDCMP message\n"); break; } } return(done); }
The window opens, has a size gadget indeed, but i can't resize it ???
Using the mouse i do get the wanted output. I can close it.
You need to set WA_MinWidth, WA_MinHeight, WA_MaxWidth and WA_MaxHeight, too. They all default to WA_Width resp. WA_Height leaving you with a non-movable size gadget.
And you don't get IDCMP_MOUSEBUTTON messges when you click on a GUI object. You should put getdimensions() into the IDCMP_NEWSIZE section. IDCMP_MOUSEBUTTON messages are only received it no other GUI element takes them.
Thanks a lot Thomas.
As a matter of fact i don't want to have the size info during the resize but after.
Gui4Cli allows you with Ctl_W to 'note' the size of a resized gui, and use this afterwards as minimum or maximum size. The results are not the same as the on you get with just opening a window at these sizes. I just want to investigate where this discrepancy has its origun from.
Interesting use of tags there. Don't forget to put a TAG_END on the end of your taglist. :-)