Control Freak #

icon mangler: Fixed a potential bug in my linked list routines, when I was adding an item to the list I wasn't making the previous last item in the list point to the new one.

With the help of someone (whyte) on #macdev (an irc channel on EFNet) I fixed the resize bug mentioned above too. It turned out I need to do a SetPort to the window, in order for the invalidate function to work. Now I'm gonna make it restrict the resizing.

Actually nevermind, I think controls are more important. Using controls in windows isn't that much harder than in dialogs, it's just you have to create them one by one from a CNTL resource (actually you don't have to use a resource, but it wouldn't be very Mac-like then). Then in your event loop, when there's a click in the content area you can use FindControl to determine if there was a control where the user clicked, and then TrackControl to determine if the user actually let go of the mouse over the control (this takes care of the highlighting too). I've added four buttons (for the four editing tools I'm planning to implement initially: pen, brush, fill and eraser). They don't do anything yet, they just beep when they're clicked on. The icon is still drawn using the whole window rect, so it looks rather weird with the controls overlapping it. But it's a start.

Post a Comment