Jump to content

Z order


bestsmr
 Share

Recommended Posts

Hello friends

I want to set object order for two object in GUI_form

but I can not find way to do .

I tried to create one before onther , but it failed .

If it was no way to ( set / change ) object order , I thing it needs to be added in next version .

Link to comment
Share on other sites

Can you show some code because there is more than one way to achieve what you describe sometimes, or there might be no way. It depends what the objects are.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

this is some code

always picture become over grapichs

*********

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 407, 279, 192, 124)

$Graphic1 = GUICtrlCreateGraphic(24, 32, 209, 129)

GUICtrlSetGraphic($Graphic1,$GUI_GR_LINE,10,10)

GUICtrlSetGraphic($Graphic1,$GUI_GR_LINE,100,100)

$Pic1 = GUICtrlCreatePic("D:\picture.jpg", 64, 64, 297, 193)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

**********

Link to comment
Share on other sites

  • Moderators

bestsmr,

The problem occurs because AutoIt always creates (or perhaps Windows forces it to create) the graphics control at the bottom of the z-order. :graduated:

Try using GDI to draw your graphics. There are plenty of examples on the forum - and plenty of help if you get stuck, although not from me personally. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi Melba23

the code was just an example to explain problem .

this code show similar problem in other way : " the Button become over picture when mouse get over it and can not be resend to back"

***********

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 710, 667, 192, 124)

$Button1 = GUICtrlCreateButton("Button1", 304, 208, 105, 89)

$Pic1 = GUICtrlCreatePic("D:\1.jpg", 64, 64, 297, 193)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

*******

and this code show similar problem in other way : " the Button1 become over Button2 when mouse get over it and can not be control it in spicific z-order"

***********

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 710, 667, 192, 124)

$Button1 = GUICtrlCreateButton("Button1", 136, 352, 105, 89)

$Button2 = GUICtrlCreateButton("Button2", 200, 408, 89, 89)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

*******

what I want to say "I thing Autoit need way to (set /change) z-order "

I hope that idea will be useful and added in next version .

do you thing as me ????????? your opinion???????

Link to comment
Share on other sites

  • Moderators

bestsmr,

I had a feeling this was coming! :D

You cannot overlap controls in AutoIt - it cannot read your mind and determine which control you wish to be on top and action and so decides to action neither. :)

The problem with your first script is easily solved - just disable the Pic control (as is explained in the Help file): ;)

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 710, 667, 192, 124)
$Pic1 = GUICtrlCreatePic("D:\1.jpg", 64, 64, 297, 193)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 304, 208, 105, 89)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0, "Button", "Pressed")
    EndSwitch
WEnd

Do not worry, you are only the 99,945th user not to have read this section of the Help file - I am reserving my wrath for the 100,000th! :D

The second script can only be solved by NOT overlapping the controls.

do you thing as me ????????? your opinion???????

If I were rude: RFTM! ;)

As I am not: Within the limitations of a scripting language, AutoIt permits a free layout of controls, but there some constraints - the most important of which is "DO NOT OVERLAP CONTROLS"! :D

All clear? :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23 ,

it is good "DO NOT OVERLAP CONTROLS"! :graduated:

but that not mean that "Autoit do not need way to set control z-order"

remark 1:

" the solution you write to first problem keep button over picture not picture over button "

remark 2:

" I read and tried GUICtrlSetState($pic1,$GUI_ONTOP) to keep picture top but the result was

in overlap region the button shown over picture but the click go to picture

the code show problem"

code

**********

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 710, 667, 192, 124)

$Button1 = GUICtrlCreateButton("Button1", 150, 150, 300, 300)

$Pic1 = GUICtrlCreatePic("D:\1.jpg", 10, 10, 300, 300)

GUICtrlSetState(-1,$GUI_ONTOP)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

MsgBox(0, "Button", "Pressed")

case $Pic1

MsgBox(0,"pic","pressed")

EndSwitch

WEnd

**********

now I can say :

" Do not worry, you have only 99,944th user not 99,945th user not to have read that section of the Help file"

yes ,we are clear , Melba23

good luck

Link to comment
Share on other sites

If you create the button after the pic then there is no problem.

If you want the pic to appear to overlap the button then create the pic first and use

BitOr($GUI_SS_DEFAULT_BUTTON, $WS_CLIPSIBLINGS)

for the button style.

Or do I not get what you are worried about?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

HI MARTIN ,

sorry , but creating pic before button will not solve problem , because the button will get over pic when mouse move over button and this is the problem .

what is the solution????????????????

I think add to Autoit function that can set z-order !!!!!!!!????????????????

Link to comment
Share on other sites

  • Moderators

bestsmr,

what is the solution

I have already told you - do not overlap the controls. :D

However, if you insist on having the button overlapped by the image you can get around the problem by using a child GUI to hold the Pic control like this: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500, 100, 100)

$hButton = GUICtrlCreateButton("Test", 10, 10, 200, 200)

GUISetState()

$hGUI_Child = GUICreate("Child", 200, 200, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
$hPic = GUICtrlCreatePic("image_path", 0, 0, 200, 200)
GUISetState()

WinMove($hGUI_Child, "", 200, 200)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hPic
            WinActivate($hGUI)
        Case $hButton
            MsgBox(0, "Pressed", "Button")
    EndSwitch

WEnd

Does that finally do what you want? :graduated:

I think add to Autoit function that can set z-order

If you looked in the Help file instead of adding ridiculous numbers of exclamation and question marks to your posts you might well have come across this function: ;)

_WinAPI_SetWindowPos 

Changes the size, position, and Z order of a child, pop-up, or top-level window

But as Autoit does not accept overlapped controls - for the very good reason that it cannot read yor mind as I explained above - this will not help in your case. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

HI MARTIN ,

sorry , but creating pic before button will not solve problem , because the button will get over pic when mouse move over button and this is the problem .

what is the solution????????????????

I think add to Autoit function that can set z-order !!!!!!!!????????????????

What you say is not clear to me. If you want the button to appear to be behind the picture then if you do what I suggested then there is no problem with the button appearing over the pic when the mouse is over it. To me you simply need to explain in clearer ways what you want.

Melba has pointed out the SetWwindowPos but I don't think it will work if you want the button to appear to be behind the pic and his child window suggestion makes sense to me.

Here is what I suggested which seems to do what you asked as I understood it.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <staticconstants.au3>
#include <winapi.au3>

#include <buttonconstants.au3>
#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 710, 667, 192, 124)

$Pic1 = GUICtrlCreatePic("D:\1.jpg", 10, 10, 300, 300)
$Button1 = GUICtrlCreateButton("Button1 partly under pic", 150, 150, 300, 300,BitOr($GUI_SS_DEFAULT_BUTTON, $WS_CLIPSIBLINGS))


;$iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE)
;_WinAPI_SetWindowPos(GUICtrlGetHandle($Button1), $HWND_TOP, 0, 0, 0, 0, $iFlags);


;GUICtrlSetState(-1,$GUI_ONTOP)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
     Case $GUI_EVENT_CLOSE
         Exit
     Case $Button1
         MsgBox(0, "Button", "Pressed")
  case $Pic1
   MsgBox(0,"pic","pressed")
    EndSwitch
WEnd

I would expect that most languages would not be able to set a button below a pic. Are you saying that you have experience of a languge where you can do that?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

SetWindowPos function

Changes the size, position, and Z order of a child, pop-up, or top-level window

DLL - User32.dll

Already suggested, but to convince me it can make a button appear below a Pic even when the mouse moves across the overlap can you give an example to demonstrate that it works. I've tried it and failed which is why I suggested using WS_CLIPSIBLINGS.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

bestsmr,

it better than melba23 solution :graduated:;):) .

Not the best way to behave if you want my help another time. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 4 years later...

hi melba i have been searching o a way arround this, i got really frustrated that i havent found anything, my problem is that i need to be deleting and creating pics, but once the pic is created it will go ontop of everything, so that why i was thinking in a child gui, but my problem is that once i set the child gui and then start with the picture deliting creation it will go i think to the child gui and no to the original gui.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>



$Form1 = GUICreate("Form1", 615, 470, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\luis\Desktop\a2mO5dd_460s.jpg", 1000, 0, 212, 404)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("", 16, 392, 588, 60)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 96, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 96, 240, 75, 25)
$Button3 = GUICtrlCreateButton("Button3", 48, 408, 75, 25)
GUISetState(@SW_SHOW)

$hGUI_Child = GUICreate("Child", 588, 60, 0, 392, 0, $WS_EX_MDICHILD, $Form1)
GUICtrlSetBkColor(-1, 0xA6CAF0)
;~ GUICtrlSetState(-1, $GUI_DISABLE)
$hButton3 = GUICtrlCreateButton("button of gui", 10, 10, 80, 30)
GUISetState()




While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ConsoleWrite($Pic1)
                GUICtrlSetPos($Pic1, 344, 40)

        Case $Button2
            GUICtrlSetData($Label1,"Label is on top ")
            GUICtrlDelete($Pic1)

        Case $Button3
            $Pic1 =GUICtrlCreatePic("C:\Users\luis\Desktop\aOVj4e6_460s_v1.jpg", 1000, 0, 212, 404)
            GUICtrlSetPos($Pic1, 300, 40)

    EndSwitch
WEnd

 

Edited by Melba23
Removed enormous and unneccesary quote
Link to comment
Share on other sites

  • Moderators

seres,

I am very unclear about what you are trying to do here, but when you say:

Quote

but my problem is that once i set the child gui and then start with the picture deliting creation it will go i think to the child gui and no to the original gui.

my suggestion would be to take a look at GUISwitch as that allows you to tell AutoIt in which GUI it should create the next controls.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 4/26/2016 at 4:33 AM, Melba23 said:

seres,

I am very unclear about what you are trying to do here, but when you say:

my suggestion would be to take a look at GUISwitch as that allows you to tell AutoIt in which GUI it should create the next controls.

M23

thanks thats what i was looking for

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...