May 27, 2024, 09:49:45 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Resizing controls

Started by LarryMc, February 27, 2008, 08:42:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

For the first time I'm trying to make a control that a user can resize by dragging the corners.

Problem is that if I have 2 of the controls on my dialog.

If I drag one of the corners to resize one control and have it supposedly cover part of the other control sometimes the resized control appears on top and sometimes it appears underneath the other.

I know, I didn't post any code.

Is there, again, some nudge you can give me to tell me where to look?

In my handler I have:      case WM_ERASEBKGND
         return 0
      case WM_SETFOCUS
         TLMSendWM_NOTIFY(hWnd, NM_SETFOCUS)
         return 0
      case WM_KILLFOCUS
         TLMSendWM_NOTIFY(hWnd, NM_KILLFOCUS)
         return 0

besides the CREATE, PAINT, and DESTROY sections.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Tried creating controls with WS_CLIPCHILDREN and WS_CLIPSIBLINGS but no change.
This is how the control is registered:  WNDCLASSEX wc
   wc.cbSize        = len(WNDCLASSEX)
   wc.style         = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW
   wc.lpfnWndProc   = &Graph1Proc_LM
   wc.cbClsExtra    = 0
   wc.cbWndExtra    = 0
   wc.hInstance     = _hinstance
   wc.hIcon         = NULL
   wc.hCursor      = LoadCursor(NULL, IDC_ARROW)
   wc.hbrBackground = NULL
   wc.lpszMenuName  = NULL
   wc.lpszClassName = "LM_Graph1_Class"
   wc.hIconSm       = NULL


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Discovered that if I put cursor on the corner of either control and double left click while sizing arror is showing that it will make proper control appear on top.  And that action is rock solid repeatable.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Windows controls are not meant to overlap.  Many of them don't respect sibling controls (controls with the same parent).  The only time you can really overlap a control is if it is a child of another control.

However if you are referring to your own home brewed controls then you'll need some more API knowledge. BringWindowToTop is one to study which will force a window (control) on top of all other windows (controls) at the same level.  Meaning the same parent.

The default Z order, or default overlapping of windows, is determined by the order of creation.  You can change the Z order with a few functions, like BringWindowToTop and SetWindowPos

Unlike a normal child window the clicking on a control doesn't meant it will come to the top of the Z order.  You have to process the WM_LBUTTONDOWN message yourself and bring the control to the top of the Z order.  Clicking on a non client area (like a title bar or border) will change the z order if your control has either.

And one final note.  All of this knowledge is useless with stock Windows edit controls, which always draw their text canvas on top of everything with no respect for Z orders, children or siblings. ;)

Paul.

Ionic Wind Support Team

LarryMc

BringWindowToTop works like a champ!

QuoteAll of this knowledge is useless with stock Windows edit controls,
Since I'm creating my on custom control that isn't an issue for me; right?

Thanks for the help as always.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library