Jump to content

Recommended Posts

Posted

Hi there,

I'm currently working on a simili-MDI app, and since I'm really interested in the upcoming feature of having more than 4096 controlID per GUI, I tried the (sample) code below on the beta vesion.

In AutoIT 3.2.10.0, you can move/minimize/maximize/close any window, including the main one - which closes the whole app.

In the beta verision (3.2.11.10), the main window can be moved, but cannot be minimized/maximized/closed, unless you close all of the sub windows first. I wonder if it's a normal/expected behavior for the next AutoIT release.

If so, anyone can help me a bit to modify my code so I can close/minimize the main window without closing the sub-windows first?

Thanks for any help!

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

Opt("GUIOnEventMode",1)

;Used to call SetParent
Global $USER32 = DllOpen("user32.dll")

;Calc the initial main window size
$MAIN_W = Round(@DesktopWidth * 0.95,0)
$MAIN_H = Round($MAIN_W * 0.75,0)


;Main GUI - will have sub-windows
$MAIN_WIN = GUICreate("Main Window", $MAIN_W, $MAIN_H,-1,-1,$WS_OVERLAPPEDWINDOW, $WS_EX_CLIENTEDGE)
GUISetOnEvent($GUI_EVENT_CLOSE, "OnWinClose")
GUISetBkColor(0x808080, $MAIN_WIN)
GUISetState(@SW_SHOW, $MAIN_WIN)


;Add a few sub-windows...
AddSubWindow()
AddSubWindow()
AddSubWindow()


StartApp()


;Adds a subwindow, randomly placed ±50 pixels off-center
Func AddSubWindow()
    $SUB_WIN = GUICreate("SubWindow", $MAIN_W/2, $MAIN_H/2,$MAIN_W/4 + Random(-50,50,1),$MAIN_H/4+ Random(-50,50,1), $WS_OVERLAPPEDWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "OnWinClose")
    GUISetState(@SW_SHOW, $SUB_WIN)
    DllCall($USER32, "int", "SetParent", "hwnd",$SUB_WIN, "hwnd", $MAIN_WIN)
EndFunc


;Enter an infinite loop (until I explicitely call "Exit")
Func StartApp()
    Do
    Until Sleep(100) = 0
EndFunc


;Function to handle EVENT_CLOSE
Func OnWinClose()
    if @GUI_WinHandle = $MAIN_WIN then;If it's the main GUI, close the app alltogether
        Exit
    Else
        GUIDelete(@GUI_WinHandle)   ;Else, just close the specified GUI window
    EndIf
EndFunc


;Closes the USER32 Dll handle
Func OnAutoItExit()
    DllClose($USER32)
EndFunc
Posted

Great - worked as expected :-D

Thanks for your helpful reply!

If you add the $WS_EX_CONTROLPARENT exstyle it seems to work

(...)

Posted

...sorry to bring this up again, but yet another question about the AutoIT beta - specifically about the ~65500 controls limit.

In previous versions, the limit was around ~4090 ctrl_id per GUI - I am able, for instance, to create 18~20 separate GUIs, each having over 4000 controls in it.

(for a total of 72000+ controls).

In 3.2.11.10, I can create ~65530 controls in a single GUI (nice!), but looks like this limit is now shared across all of the GUIs.

So if I created 60000 controls on one GUI, I can't create more than another ~5500 controls on the other GUIs

While this is far from being a huge problem, I wonder if this is intended, and if there is a way to work around this.

(And if someone wonders why I play with such high count of controls in single GUI, it's mainly because I dump SQL recordsets directly into listviews, and it can happen that I get 10000+ rows in one query, creating 10000+ listview items.)

Thanks to anyone who have some more infos!

Posted

(And if someone wonders why I play with such high count of controls in single GUI, it's mainly because I dump SQL recordsets directly into listviews, and it can happen that I get 10000+ rows in one query, creating 10000+ listview items.)

In that case you should not use the GuiCtrlCreateListViewItem function.

Instead use _GUICtrlListView_xxx UDF routines to manage your listviews.

Posted

I was not aware that theses would "bypass" the limitations - good to know.

Everything now work as expected (albeit ~3x slower to fill the lists), but it's no big deal... I can wait ~4 secs instead of ~1 sec to get my lists ;-)

Thanks for your great help again!

In that case you should not use the GuiCtrlCreateListViewItem function.

Instead use _GUICtrlListView_xxx UDF routines to manage your listviews.

Posted (edited)

I was not aware that theses would "bypass" the limitations - good to know.

Everything now work as expected (albeit ~3x slower to fill the lists), but it's no big deal... I can wait ~4 secs instead of ~1 sec to get my lists ;-)

Thanks for your great help again!

If you're adding tons of items to the list,try using _GUICtrlListView_AddArray,it does all the preparation once instead of every addition,so it should be much faster. Edited by danielkza

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
  • Recently Browsing   0 members

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