Jump to content

Recommended Posts

Posted

I wonder if the way that you posted earlier is the solution? I can't say I really understand what's really happening in that post though.

Posted

To each window handle you can assign specific proprety name, ie. "Object". To that propetry you should assign pointer to the object. Later, whenever you have handle to a window or control you get the corresponding objct via the _WinAPI_GetProp().

I am not sure if this is the access you wanted.

Posted (edited)

Ok, I think I figured out a solution ... updating the first post!

Here's the code from the example:

#AutoIt3Wrapper_UseX64=N

#include <GUIConstantsEx.au3>

#include "..\AutoItObject.au3"
#include "..\Canvas\Canvas.au3"

Example()

Func Example()
    _AutoItObject_StartUp()

    Local Const $canvas = Canvas()

    $canvas.Form("MyForm", "GUIObjects Example", 300, 500)

    $canvas.MyForm.OnClose("MyFormClose")

    $canvas.MyForm.SetFont("Segoe UI")

    $canvas.Button("MyButton1", "Example Button 1", 20, 20)

    $canvas.MyButton1.OnEvent("MyButton1Handler")

    $canvas.Checkbox("MyCheckbox", "Example Checkbox", 20, 55)
    
    $canvas.MyCheckbox.OnEvent("MyCheckboxHandler")

    $canvas.MyCheckbox.Check()    
    
    $canvas.MyForm.Show()

    Do
        $canvas.Handler(GUIGetMsg($GUI_EVENT_ARRAY))
    Until False
EndFunc

Func MyButton1Handler($this, Const $canvas)
    ConsoleWrite($this.Text & ": Clicked" & @CRLF)

    Consolewrite("This is the MyCheckbox text: " & $canvas.MyCheckbox.Text & @CRLF)

    Return True
EndFunc

Func MyCheckboxHandler($this, Const $canvas)
    ConsoleWrite($this.Text & " Is Checked: " & $this.IsChecked() & @CRLF)

    Return True
EndFunc

Func MyFormClose($this)
    ConsoleWrite("Exiting!" & @CRLF)

    $this = Null

    _AutoItObject_ShutDown()

    Exit
EndFunc

So, when you create a form or a control then the first parameter should be a unique name so that it can be referenced via the Canvas object.

Edited by jaberwacky
  • jaberwacky changed the title to Object Oriented Like GUIs -- GUIObjects
Posted
On 10/6/2026 at 11:22 AM, jaberwacky said:

Good question! 😅

It offers nothing that AutoIt can't already do. I simply have a fascination with the concept and won't be satisfied until I have implemented it.

This, for me, is reason enough.

You go, sir! Some of the finest AutoIt UDFs started just like this!

nothing is foolproof to the sufficiently talented fool..

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
×
×
  • Create New...