Jump to content
Sign in to follow this  
MachinistProgrammer

problem with layering

Recommended Posts

MachinistProgrammer

I'm working on an autoit built generic installer. how can i get the buttons to work (i know there is probably 1000 better ways to do it

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product&" Installer",495,360,-1,-1,-1,-1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")
GUICtrlCreateLabel("",0,310,495,50,-1,131072)
GUICtrlSetBkColor(-1,0xF0F0F0)
$n = GUICtrlCreateButton("Next >",325,320,75,25,-1,-1)
$c = GUICtrlCreateButton("Cancel",410,320,75,25,-1,-1)
GUICtrlCreateLabel("Instant Install wil guide you through the setup of "&$product&"."&@crlf&""&@crlf&"It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer."&@crlf&""&@crlf&"Click Next to continue.",180,100,250,120,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISetState(@SW_SHOW,$i1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

and if i do it this way the buttons don't appear

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product&" Installer",495,360,-1,-1,-1,-1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")
$n = GUICtrlCreateButton("Next >",325,320,75,25,-1,-1)
$c = GUICtrlCreateButton("Cancel",410,320,75,25,-1,-1)
GUICtrlCreateLabel("",0,310,495,50,-1,131072)
GUICtrlSetBkColor(-1,0xF0F0F0)
GUICtrlCreateLabel("Instant Install wil guide you through the setup of "&$product&"."&@crlf&""&@crlf&"It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer."&@crlf&""&@crlf&"Click Next to continue.",180,100,250,120,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISetState(@SW_SHOW,$i1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by sycam0inc

All my projects live on github

Share this post


Link to post
Share on other sites
kaotkbliss

you need to disable your pic after you set it to a button so you can "click through it"

*edit*

something like

$pic = GUICtrlCreatePic("resize",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")
GUICtrlCreateLabel("",0,310,495,50,-1,131072)
GUICtrlSetBkColor(-1,0xF0F0F0)

guictrlsetstate($pic,$gui_disable)
 

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites
MachinistProgrammer

no its not the picture over the button its the label bu i found the solution

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product&" Installer",495,360,-1,-1,-1,-1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")
$n = GUICtrlCreateButton("Next >",325,320,75,25,-1,-1)
$c = GUICtrlCreateButton("Cancel",410,320,75,25,-1,-1)
GUICtrlCreateLabel("",0,310,495,50,-1,131072)
GUICtrlSetBkColor(-1,0xF0F0F0)
GUICtrlCreateLabel("Instant Install wil guide you through the setup of "&$product&"."&@crlf&""&@crlf&"It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer."&@crlf&""&@crlf&"Click Next to continue.",180,100,250,120,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISetState(@SW_SHOW,$i1)
ControlFocus($i1,"",GUICtrlGetHandle($n))
ControlFocus($i1,"",GUICtrlGetHandle($c))
While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE,$c
         Exit
    EndSwitch
WEnd

All my projects live on github

Share this post


Link to post
Share on other sites
kylomas

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product&" Installer",495,360)  ; don't need to specify defaults if no significant values follow
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")

; this control was overlapping with the buttons
GUICtrlCreateLabel("",0,310,495,10,-1,131072)
GUICtrlSetBkColor(-1,0xF0F0F0)

$n = GUICtrlCreateButton("Next >",325,320,75,25,-1,-1)
$c = GUICtrlCreateButton("Cancel",410,320,75,25,-1,-1)

GUICtrlCreateLabel("Instant Install wil guide you through the setup of "&$product&"."&@crlf&""&@crlf&"It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer."&@crlf&""&@crlf&"Click Next to continue.",180,100,250,120,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISetState(@SW_SHOW,$i1)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
        Case $GUI_EVENT_CLOSE,$c
            Exit
        case $n
            msgbox(0,0,'Next button prssed')
    EndSwitch
WEnd

sycam0inc,

You're right, it was the label overlapping with the buttons...this is a better solution, however...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
MachinistProgrammer

I wanted a gray box behind the buttons not a separator

so now that i read Kaotkbliss post more closley this is the final answer

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product&" Installer",495,360,-1,-1,-1,-1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\",0,0,160,310,-1,-1)
GUICtrlCreateLabel("Welcome to the "&$product&" Instant Installer",180,20,260,50,-1,-1)
GUICtrlSetFont(-1,15,400,0,"MS Sans Serif")
GUICtrlCreateLabel("",0,310,495,50,-1,131072)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlSetBkColor(-1,0xF0F0F0)
$n = GUICtrlCreateButton("Next >",325,320,75,25,-1,-1)
$c = GUICtrlCreateButton("Cancel",410,320,75,25,-1,-1)
GUICtrlCreateLabel("Instant Install wil guide you through the setup of "&$product&"."&@crlf&""&@crlf&"It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer."&@crlf&""&@crlf&"Click Next to continue.",180,100,250,120,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISetState(@SW_SHOW,$i1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by sycam0inc

All my projects live on github

Share this post


Link to post
Share on other sites
Malkey

I believe the z-order of controls is in the order of their creation. The top of the z-order is the last created.

So to have the buttons on top, create the buttons last.

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product & " Installer", 495, 360, -1, -1, -1, -1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\", 0, 0, 160, 310, -1, -1)
GUICtrlCreateLabel("Welcome to the " & $product & " Instant Installer", 180, 20, 260, 50, -1, -1)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlCreateLabel("", 0, 310, 495, 50, -1, 131072)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlCreateLabel("Instant Install wil guide you through the setup of " & $product & "." & @CRLF & "" & @CRLF & "It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer." & @CRLF & "" & @CRLF & "Click Next to continue.", 180, 100, 250, 120, -1, -1)
GUICtrlSetBkColor(-1, "-2")
$n = GUICtrlCreateButton("Next >", 325, 320, 75, 25, -1, -1)
$c = GUICtrlCreateButton("Cancel", 410, 320, 75, 25, -1, -1)
GUISetState(@SW_SHOW, $i1)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $c
            Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
BrewManNH

If you disable the label you won't have to worry about when it is created, z-order doesn't matter if the label is disabled because it won't affect any controls that it surrounds, just like when using a Pic as a background.

 

Just use $GUI_DISABLED for every control you use as a background.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Malkey

If you disable the label you won't have to worry about when it is created, z-order doesn't matter if the label is disabled because it won't affect any controls that it surrounds, just like when using a Pic as a background.

 

 

Just use $GUI_DISABLED for every control you use as a background.

@BrewManNH

I also thought this would work.  But in practise, it doesn't work.

 

This script does not work.

; buttons not appearing on  Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product & " Installer", 495, 360, -1, -1, -1, -1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\", 0, 0, 160, 310, -1, -1)
GUICtrlCreateLabel("Welcome to the " & $product & " Instant Installer", 180, 20, 260, 50, -1, -1)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlCreateLabel("Instant Install wil guide you through the setup of " & $product & "." & @CRLF & "" & @CRLF & "It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer." & @CRLF & "" & @CRLF & "Click Next to continue.", 180, 100, 250, 120, -1, -1)
GUICtrlSetBkColor(-1, "-2")
$n = GUICtrlCreateButton("Next >", 325, 320, 75, 25, -1, -1)
$c = GUICtrlCreateButton("Cancel", 410, 320, 75, 25, -1, -1)
GUICtrlCreateLabel("", 0, 310, 495, 50, -1, 131072)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW, $i1)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $c
            Exit
    EndSwitch
WEnd

Moving the two GUICtrlCreateButton functions to just above GUISetState(@SW_SHOW, $i1) makes the button appear.

Share this post


Link to post
Share on other sites
kaotkbliss

so does mousing over the buttons in your unaltered script above. gui_disable does not hide anything, it makes it inactive.

put your buttons just above the guisetstate as you mentioned, but comment out the gui_disable line and try to click cancel. go ahead, try.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites
BrewManNH

Odd, it's always worked right for me, but that script definitely doesn't.

BTW, could you PLEASE use the correct constant variables when posting a script like that? It's a pain in the ass trying to figure out what it is you're using when you use magic numbers like that. First I have to convert them to hex then look them up in the help file, and hope that they're listed and you haven't added some together. Thanks.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
MachinistProgrammer

@BrewManNH

I also thought this would work.  But in practise, it doesn't work.

 

This script does not work.

; buttons not appearing on  Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
$product = "test"
$i1 = GUICreate($product & " Installer", 495, 360, -1, -1, -1, -1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic("resize\", 0, 0, 160, 310, -1, -1)
GUICtrlCreateLabel("Welcome to the " & $product & " Instant Installer", 180, 20, 260, 50, -1, -1)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlCreateLabel("Instant Install wil guide you through the setup of " & $product & "." & @CRLF & "" & @CRLF & "It is recommended that you close all other applications before starting setup. This will make it possable to update relevent system files without rebooting your computer." & @CRLF & "" & @CRLF & "Click Next to continue.", 180, 100, 250, 120, -1, -1)
GUICtrlSetBkColor(-1, "-2")
$n = GUICtrlCreateButton("Next >", 325, 320, 75, 25, -1, -1)
$c = GUICtrlCreateButton("Cancel", 410, 320, 75, 25, -1, -1)
GUICtrlCreateLabel("", 0, 310, 495, 50, -1, 131072)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW, $i1)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $c
            Exit
    EndSwitch
WEnd

Moving the two GUICtrlCreateButton functions to just above GUISetState(@SW_SHOW, $i1) makes the button appear.

 

what disabling the label dose is make the buttons work

because for some strange reason the z-layer for viewing is different than the mouses z-layer

so if the label goes before the buttons and is disabled it should work


All my projects live on github

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×