Re: [WIN] Label text colors and window control...
- Posted by George Henry <ghenryca at HOTMAIL.COM> Jan 22, 2001
- 553 views
Leviathan has seen that it can be done, now wants to go do it. So good comes from goofups, occasionally. <snip> another control will be allowed to move the window around. Where do I start to do this? </snip> I've been tinkering with window positioning myself. setRect puts it where you want it. If you don't want to change the size, use ... well here, let me drop a few lines of code: <code (somewhat tested)> -- Where posSeq is a "position sequence" -- {control_id, position_left, position_top} -- Make sure that posSeq[CTL_ID] identifies a window .... extent = getRect(Screen) size = getCtlSize(posSeq[CTL_ID]) -- Ensure that the window will be positioned so that it is entirely on the screen. posSeq[POS_LEFT] = min({posSeq[POS_LEFT], extent[SCR_WIDTH] - size[CTL_WIDTH]}) posSeq[POS_LEFT] = max({posSeq[POS_LEFT], 0}) posSeq[POS_TOP] = min({posSeq[POS_TOP], extent[SCR_HEIGHT] - size[CTL_HEIGHT]}) posSeq[POS_TOP] = max({posSeq[POS_TOP], 0}) setRect(posSeq[1], posSeq[2], posSeq[3], size[1], size[2], False) </code> If you want my min and max functions, I'll be happy to send them. I rolled my own, tho there are prolly just-as-good-or-better ones in an existing liebury somewhere. max(atom) = the atom, to be nice max(seq) = the greatest element, except: max({}) = the program crashes (not so nice)! and min works similarly. You might want to do your position checking and rectifying interactively while the user is tinkering with the control. George _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com