The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RHL on March 28, 2012, 02:20:14 AM

Title: how send to back a control?
Post by: RHL on March 28, 2012, 02:20:14 AM
hello people, I have a question  :(
I have several controls but my problem is that some controls are above others and let me know how I can send a control to back at runtime?
for example:

(http://img52.imageshack.us/img52/6499/sinttuloriy.png)

I want send to back the control label, thanks people
Title: Re: how send to back a control?
Post by: qWord on March 28, 2012, 05:21:45 AM
Using the WS_CLIPSIBLINGS-style for the controls should solve your problem.
Title: Re: how send to back a control?
Post by: RHL on March 28, 2012, 08:10:56 AM
But I want do in runtime , thanks
Title: Re: how send to back a control?
Post by: qWord on March 28, 2012, 04:02:45 PM
Quote from: RHL on March 28, 2012, 08:10:56 AM
But I want do in runtime , thanks
why? give us more information.
Have you tried SetWindowPos() (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx)?
Title: Re: how send to back a control?
Post by: RHL on March 28, 2012, 05:12:17 PM
qWord thanks u, well what I really want is set a control the background STATIC class to load an image in it, and move that
control STATIC as background under all but my problem is that control is above some  :(
Title: Re: how send to back a control?
Post by: qWord on March 28, 2012, 05:39:36 PM
You may try this: add the WS_CLIPSIBLINGS flag to the STATIC's style using Get/SetWindowLong(hStatic,GWL_STYLE [,style]) and then invalidate the whole dialog/window using InvalidRect(hWnd,0,1).
Title: Re: how send to back a control?
Post by: jj2007 on March 28, 2012, 06:05:47 PM
The order of creation may play a role. Try creating the static first.
Title: Re: how send to back a control?
Post by: donkey on March 29, 2012, 12:24:02 AM
As qWord said, use SetWindowPos specifying HWND_BOTTOM, that should work for you.

invoke SetWindowPos, hStatic, HWND_BOTTOM, 0,0,0,0,SWP_NOMOVE + SWP_NOSIZE + SWP_SHOWWINDOW
Title: Re: how send to back a control?
Post by: dedndave on April 01, 2012, 08:41:41 PM
i created this little app to demonstrate a static image in the background
it also demonstrates the use of tables to create controls and windows
i could have used the same class/WndProc for the child windows
but RHL intends to have vastly different controls in each, so i seperated them

i used 24-bit BMP images, so the thing is too big for the forum   :P

EDIT: link replaced in next post
Title: Re: how send to back a control?
Post by: dedndave on April 01, 2012, 08:52:20 PM
try this link, instead...
http://dedndave.x10hosting.com/RHLWin.zip
Title: Re: how send to back a control?
Post by: dedndave on April 02, 2012, 02:33:42 AM
ok - a bit of an improvement
in the previous version, i set button fonts individually after creation
i wasn't happy with it - lol

in this version...
if the control is either a Static or a Button, i set the font as it is created
that makes for much cleaner code

also, i changed from 24-bit images to 256-color images
so, the thing fits on the forum board   :P
if you wanted to do some kind of "vector" images (lines, etc), 256-colors would be plenty
Title: Re: how send to back a control?
Post by: hfheatherfox07 on April 02, 2012, 02:41:27 AM
Quote from: dedndave on April 02, 2012, 02:33:42 AM
ok - a bit of an improvement
in the previous version, i set button fonts individually after creation
i wasn't happy with it - lol

in this version...
if the control is either a Static or a Button, i set the font as it is created
that makes for much cleaner code

also, i changed from 24-bit images to 256-color images
so, the thing fits on the forum board   :P
if you wanted to do some kind of "vector" images (lines, etc), 256-colors would be plenty

Nice I seen something like this but  the picture changes with the clock on the CP...
So after say 6:30 PM you would see the sun set image after 12AM a night image ... I wonder how to do that .....
I know how to get system time soooo.....
very cool  :U