Jump to content

How to make a child GUI


Recommended Posts

Do you mean like this?

#include <GuiConstants.au3>

$parent = GuiCreate("Parent", 300, 200, 10, 10, 0x14CF0000)
GuiSetState(@SW_SHOW)

$child = GuiCreate("Child", 100, 100, 10, 10, 0x56CF0000, 0x00040100 , $parent)
$button = GUICtrlCreateButton("example", 10, 10)
GuiSetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit ;when click either close button
    If $msg = $button Then MsgBox(4096, "Example", "Message")
WEnd
I copied the window styles from another program using WinSpy++

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Do you mean like this?

#include <GuiConstants.au3>

$parent = GuiCreate("Parent", 300, 200, 10, 10, 0x14CF0000)
GuiSetState(@SW_SHOW)

$child = GuiCreate("Child", 100, 100, 10, 10, 0x56CF0000, 0x00040100 , $parent)
$button = GUICtrlCreateButton("example", 10, 10)
GuiSetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit;when click either close button
    If $msg = $button Then MsgBox(4096, "Example", "Message")
WEnd
I copied the window styles from another program using WinSpy++

<{POST_SNAPBACK}>

yea thanx man. :)
Link to comment
Share on other sites

i didn't know autoit could do that, cool

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

have been wrestling with this for a couple weeks...but came up with some stuff that seems to work ok so far( My greatest Thanks to VALIK and LARRY for having patience with me, and explaining the concepts!!)

#cs-------Version and Author Data------------------------------------------------------------------
; ***************************************************
; ****AutoIt Version: 3.1.0**************************
; ************Author: Quaizywabbit.*************
; *******************************************
; ***************************************************
#ce-------------------------------------------------------------------------------------------------
#include <guiconstants.au3>
#region GuiTarget; User call tip entry: _GuiTarget("WinTitle",["Text",[ControlId]])
Global $wintitle
Global $wintext = 0
Global $controlid = 0
Global $hWnd = 0
Func _GuiTarget($wintitle, $wintext = 0, $controlid = 0)
   WinWait($wintitle)
   $hWnd = WinGetHandle($wintitle)
   If Not $controlid = 0 Then $hWnd = ControlGetHandle($wintitle, $wintext, $controlid)
EndFunc  ;==>_GuiTarget
#endregion
#region EndTarget; Clears values set in GuiTarget
Func _EndTarget()
   $wintitle = 0
   $wintext = 0
   $controlid = 0
   $hWnd = 0
EndFunc  ;==>_EndTarget
#endregion
#region _TargetChildCreate; Standard GUICtrlCreate Func's used with this one..
;User call tip entry: _TargetChildCreate("Title", SizeX, SizeY, PosX, PosY)
Func _TargetChildCreate($Title, $SizeX, $SizeY, $PosX, $PosY);Embeds a child window to any parent window
   GUICreate($Title, $SizeX, $SizeY, $PosX, $PosY, $WS_CHILD, -1, $hWnd)
EndFunc  ;==>_TargetChildCreate
#endregion
#region _Targetbtnadd; User call tip entry: _Targetbtnadd("BtnText",PosX,PosY,SizeX,SizeY,[style,[exstyle]])
Func _Targetbtnadd($buttontext, $PosX, $PosY, $SizeX, $SizeY, $style = 0, $exstyle = 0)
   GUICreate($buttontext, $SizeX, $SizeY, $PosX, $PosY, $WS_CHILD, -1, $hWnd)
   GUICtrlCreateButton($buttontext, 0, 0, $SizeX, $SizeY, $style, $exstyle)
EndFunc  ;==>_Targetbtnadd
#endregion

Haven't tested EndTarget() yet.. but basically you call GuiTarget() then either Targetbtnadd() or TargetChildCreate()....or both! each item is embedded in the target.......

So far so good.......back to tinkering!!! :)

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Sorry this is all I have so far.....

;ANY GUI FUNCTIONS wriiten by Quaizy
#region Hoster demo addbutton
opt ("WinTitleMatchMode", 2)
#include <xgui.au3>
#include <GUIConstants.au3>; must be included in main script for GUI Functions to work
Run('C:\Program Files\Micro Technology Unlimited\Hoster Demo\Hoster-demo.exe')
Sleep(2000)
WinActivate("Dialog")
ControlClick("Dialog", "Demo", 1); clears demo dialog box
WinSetState(" - Hoster", "", @SW_MAXIMIZE)
Sleep(2000)
#include <ReconfigureSearchwindow.au3>; makes search window half size
ControlMove("Hoster", "", 1017, 20, 239, 700, 463);moves playlist out of the way for green panel
_GuiTarget("Hoster", "", 59648);<== the targets main GUI is a control
_targetbtnadd("Test", 750,20, 100, 50)
GUISetState(@SW_SHOW)
_targetbtnadd("Test", 860,20, 100, 50)
GUISetState(@SW_SHOW)
_targetbtnadd("Test", 750,80, 100, 50)
GUISetState(@SW_SHOW)
_targetbtnadd("Test", 860,80, 100, 50)
GUISetState(@SW_SHOW)
_targetbtnadd("Test", 750,140, 100, 50)
GUISetState(@SW_SHOW)
_targetbtnadd("Test", 860,140, 100, 50)
GUISetState(@SW_SHOW)
_TargetChildCreate("Testing", 300, 600, 730, 200)
GUISetBkColor(0xff00)
GUISetState(@SW_SHOW)
While WinExists($hWnd)
      Sleep(100)
      If Not WinExists($hWnd) Then
         Exit
      EndIf
  WEnd
  _EndTarget()
  
#endregion

anyhow I included it in my script(xgui.au3...Name it anything you like, just #include it) and coded as above...the attached jpg image shows the desired result.

I was aiming to make a more efficient means to work with GUI's AutoIT didn't create...(note: the six buttons on the Top right and the green panel are individual Child windows. I didn't assign variables referring to each control, was just testing to make sure everything showed up)

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
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...