![]() |
|
|||||||
| Dynamic Dialog Tools (DDT) Discussion is limited to GUI development using DDT. Comments about SDK programming are allowed only for functionality which enhances DDT. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Overlay or Top Most Control
This one is puzzling. I have a proprietary control which seems to want to remain the top most, regardless of what I attempt to overlay, in this case a small graphic box.
The first control has a background image of a computer monitor or television screen. Think of it as a part of the control that is static and cannot be removed. Now, I'm using GDI+ to create a simple rectangle that fits within the television screen or would if it would be the top most object. I miniaturized the control and can see the image that should be overlaid so I know that is working. The question is: How do I change an object's z-order or make it overlay another? |
|
#2
|
|||
|
|||
|
See the setwindowspos API, possibly.
|
|
#3
|
|||
|
|||
|
That looks like it should work.
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx This example code will swap the z-order of two CONTROL objects, one a LABEL, and the other a BUTTON. Code:
'compilable example code
#COMPILE EXE
#DIM ALL
#INCLUDE "win32api.inc"
FUNCTION PBMAIN () AS LONG
LOCAL hDlg AS DWORD
DIALOG NEW PIXELS, 0, "Change Z Order", , , 220, 50, %WS_OVERLAPPEDWINDOW TO hDlg
CONTROL ADD LABEL , hDlg, 100, "Label Control", 5, 5, 200, 20, %SS_CENTER
CONTROL ADD BUTTON , hDlg, 101, "Button Control", 10, 10, 135, 30
DIALOG SHOW MODAL hDlg, CALL DlgProc TO hDlg
FUNCTION = hDlg
END FUNCTION
CALLBACK FUNCTION DlgProc()
STATIC topctl AS LONG
LOCAL hctl AS DWORD
SELECT CASE CB.MSG
CASE %WM_INITDIALOG
CASE %WM_COMMAND
SELECT CASE CB.CTL
CASE %IDCANCEL
DIALOG END CB.HNDL
CASE %IDOK, 101
topctl = 100 - (topctl = 100)
CONTROL HANDLE CB.HNDL, topctl TO hctl
SetWindowPos(hctl, %hwnd_top, 0, 0, 0, 0, %swp_nosize OR %swp_nomove)
CONTROL REDRAW CB.HNDL, topctl
END SELECT
END SELECT
END FUNCTION
__________________
The world is strange and wonderful.* I reserve the right to be horrifically wrong. Please maintain a safe following distance. *wonderful sold separately. |
|
#4
|
|||
|
|||
|
That sounds good
That sounds like what I'm looking for. I'll get to try it tomorrow afternoon after I get home from work. I don't have the latest version of my source code on my laptop.
![]() I'll let the forum know if it works. It may help others also which is a bonus. ================ It sort of worked. The overlay flashed before the background overlaid it. I tried also sending the custom control to the back and it still pops on top. I'm thinking of other ideas too, this is just the latest attempt. Last edited by Randal Lanning; May 14th, 2012 at 08:50 PM. Reason: An update and don't want to double post. |
![]() |
| Tags |
| ddt, gdi, overlay, z-order |
| Thread Tools | |
| Display Modes | |
|
|