PowerBASIC Peer Support Forums
 

Go Back   PowerBASIC Peer Support Forums > User to user Discussions > Dynamic Dialog Tools (DDT)

Dynamic Dialog Tools (DDT) Discussion is limited to GUI development using DDT. Comments about SDK programming are allowed only for functionality which enhances DDT.

Reply
 
Thread Tools Display Modes
  #1  
Old May 12th, 2012, 04:43 PM
Randal Lanning Randal Lanning is offline
Member
 
Join Date: Dec 2008
Location: Atlanta, GA USA
Posts: 16
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?
Reply With Quote
  #2  
Old May 12th, 2012, 05:21 PM
Chris Holbrook Chris Holbrook is offline
Member
 
Join Date: Aug 2005
Location: in Hiding
Posts: 6,394
See the setwindowspos API, possibly.
Reply With Quote
  #3  
Old May 13th, 2012, 01:48 AM
Kurt Kuzba Kurt Kuzba is offline
Member
 
Join Date: Sep 2004
Location: Wisconsin
Posts: 749
Quote:
Originally Posted by Chris Holbrook View Post
See the setwindowspos API, possibly.
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.
Reply With Quote
  #4  
Old May 13th, 2012, 07:57 PM
Randal Lanning Randal Lanning is offline
Member
 
Join Date: Dec 2008
Location: Atlanta, GA USA
Posts: 16
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.
Reply With Quote
Reply

Tags
ddt, gdi, overlay, z-order

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:33 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1999-2011 PowerBASIC, Inc. All Rights Reserved.
Error in my_thread_global_end(): 1 threads didn't exit