Sign in to follow this  
Followers 0
Rawox

Multiple GUI

11 posts in this topic

Hi there,

I'm currently workin' on a script and I want to know of it is possible to create a GUI every time a user pushes a button or something like that.

I have a function that creates that GUI but if I call the function the GUI will only show up ones...

Any help is appreciated.. ;)

Thanks in advance,

Rawox

Share this post


Link to post
Share on other sites



Rawox,

Without any code it is difficult to offer any advice..... ;)

However, if you want to show GUIs on multiple button presses, it is usually a good idea to create the GUI just the once, and then use GUISetState($GUI_SHOW/$GUI_HIDE) to show/hide it as required.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Well the code isn't really interesting ;)

#AutoIt3Wrapper_Plugin_Funcs 
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Include <Color.au3>

$Title = "RPixFix"

createFixer ( 20, 20, 0 )

Func createFixer ( $FixerWidth, $FixerHeight, $FixerRefreshMS )
    Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
    $Color =  _ColorSetRGB ( $AllColors )
    
    $GUIName =              GUICreate ( $Title & " is fixing pixels...", $FixerWidth, $FixerHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )

    $Label =                GUICtrlCreateLabel ( "", 0, 0, $FixerWidth, $FixerHeight, -1, $GUI_WS_EX_PARENTDRAG )
                            GUICtrlSetBkColor ( $Label, $Color )
                            
                            GUISetCursor ( 3, 1 )
                            GUISetState ( @SW_SHOW, $GUIName )
                            
    While 1
        If StringTrimLeft ( Hex ( $Color ), 2 ) = "0000FF" Then ;//' BLUE '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0xff, 0x00]  ;//' GREEN '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0xff, 0x00, 0x00]  ;//' RED '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        ElseIf StringTrimLeft ( Hex ( $Color ), 2 ) = "00FF00" Then ;//' GREEN '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0xff, 0x00, 0x00]  ;//' RED '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        ElseIf StringTrimLeft ( Hex ( $Color ), 2 ) = "FF0000" Then ;//' RED '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0x00, 0xff, 0x00]  ;//' GREEN '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        EndIf
        
        Sleep ( $FixerRefreshMS + 1 )
        GUICtrlSetBkColor ( $Label, $Color )
        
        Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
    WEnd
EndFunc

I need to make an GUI with options, height, width etc. (maybe more stuff) and when the user clicks ok for example it needs to do createFixer() Function. But When I call the function 2 times it just displays one GUI...

Share this post


Link to post
Share on other sites

Rawox,

Please try and explain exactly what you are trying to do, because at the moment I am completly baffled - which makes it a bit difficult to help. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

probably becose your func have while loop in it

Do this help or i did not understand you correctly

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Include <Color.au3>

$Title = "RPixFix"

$1 = GUICreate("")
$2 = GUICtrlCreateButton("OK",-1,-1)
GUISetState ( @SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $2
            createFixer ( 20, 20, 0 )
    EndSelect
WEnd
Func createFixer ( $FixerWidth, $FixerHeight, $FixerRefreshMS )
    $GUIName = GUICreate ( $Title & " is fixing pixels...", $FixerWidth, $FixerHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )
    $Label = GUICtrlCreateLabel ( "", 0, 0, $FixerWidth, $FixerHeight, -1, $GUI_WS_EX_PARENTDRAG )
    GUISetCursor ( 3, 1 )
    GUISetState ( @SW_SHOW, $GUIName )
EndFunc

(move your first popup gui winh mouse on some other position to see second created)


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Because the GuiGetMsg() loop is inside the function that creates the GUI, it never exits the function until it Exits the script, so it can't be called twice.

:evil:

Oops, typing slow because I was bogq'ed down... ;)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Well, I'm trying to create my own stuck pixel fixer...

The method suggested by bogQ works when I create multiple GUI's but if you look at my original code you see it needs to switch between R G B colors but I don't know how to add it...

What I am trying to do: create a script that fixes stuck pixels by changing a color from red to green to blue (randomly). Because a monitor can have multiple stuck pixels I need it to make multiple "Fixers".

Do you understand now Melba23?

Thanks in advance!

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Include <Color.au3>

$Title = "RPixFix"

$1 = GUICreate("")
$2 = GUICtrlCreateButton("OK",-1,-1)
GUISetState ( @SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $2
            createFixer ( 20, 20, 0, Random ( 1, 10 ) )
    EndSelect
WEnd

Func createFixer ( $FixerWidth, $FixerHeight, $FixerRefreshMS, $GUIName )
    Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
    $Color =  _ColorSetRGB ( $AllColors )
    
    $GUIName =              GUICreate ( $Title & " is fixing pixels...", $FixerWidth, $FixerHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )

    $Label =                GUICtrlCreateLabel ( "", 0, 0, $FixerWidth, $FixerHeight, -1, $GUI_WS_EX_PARENTDRAG )
                            GUICtrlSetBkColor ( $Label, $Color )
                            
                            GUISetCursor ( 3, 1 )
                            GUISetState ( @SW_SHOW, $GUIName )
                            
    #cs
    Do
        If StringTrimLeft ( Hex ( $Color ), 2 ) = "0000FF" Then ;//' BLUE '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0xff, 0x00]  ;//' GREEN '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0xff, 0x00, 0x00]  ;//' RED '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        ElseIf StringTrimLeft ( Hex ( $Color ), 2 ) = "00FF00" Then ;//' GREEN '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0xff, 0x00, 0x00]  ;//' RED '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        ElseIf StringTrimLeft ( Hex ( $Color ), 2 ) = "FF0000" Then ;//' RED '\\;
            If Random ( 1, 2, 1 ) = 1 Then
                Dim $AllColors[3] = [0x00, 0x00, 0xff]  ;//' BLUE '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            Else 
                Dim $AllColors[3] = [0x00, 0xff, 0x00]  ;//' GREEN '\\;
                $Color =  _ColorSetRGB ( $AllColors )
            EndIf
        EndIf
        
        Sleep ( $FixerRefreshMS + 1 )
        GUICtrlSetBkColor ( $Label, $Color )
    Until 1 = 2
    #ce
EndFunc

This works, but when #cs and #ce is removed it changes colors but doesn't work anymore, I can't add multiple GUI's then ;)

Edited by Rawox

Share this post


Link to post
Share on other sites

Rawox,

Yes, I understand perfectly now! :evil: Here is one way you might do what you want:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Include <Misc.au3>

; Array to hold fixer GUI handles & Fixer GUI colours
Global $ahFixers[11] = [0], $aAllColors[3] = [0xFF0000, 0x00FF00, 0x0000FF]

; Needed for _IsPressed
$UserDLL = DllOpen("user32.dll")

; Main GUI
$sTitle = "RPixFix"
$stext = "Press the 'Fix' button and then click on the screen." & @CRLF & "A fixer GUI will appear at that point." & @CRLF & @CRLF & "Press 'Exit' to exit (as if you could not guess!)"

$hGUI = GUICreate($sTitle, 280, 140)

$sLabel = GUICtrlCreateLabel($sText, 10, 10, 260, 90, $SS_CENTER)

$hFix_Button = GUICtrlCreateButton("Fix!", 40, 100, 80, 30)

$hExit_Button = GUICtrlCreateButton("Exit", 160, 100, 80, 30)

GUISetState()

; Set colour index
$iColourCount = 0

; Change Fixer GUI colour every 1 sec - change value to flash faster
AdlibRegister("Switch_Colour", 1000)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit_Button
            DllClose($UserDLL)
            Exit
        Case $hFix_Button
            Create_Fixer()
    EndSwitch

WEnd

Func Switch_Colour()

    ; Change colour index, but only between 0, 1, 2
    $iColourCount = Mod($iColourCount + 1, 3)

    ; Change colour for all Fixer GUIs
    For $i = 1 To $ahFixers[0]
        GUISetBkColor($aAllColors[$iColourCount], $ahFixers[$i])
    Next

EndFunc

Func Create_Fixer()

    ; Hide main GUI
    GUISetState(@SW_HIDE, $hGUI)

    ; Wait until mouse button pressed
    While Not _IsPressed("01", $UserDLL)
        Sleep(10)
    WEnd
    ; Get mouse position
    $aMouse_Pos = MouseGetPos()
    $iX = $aMouse_Pos[0] - 5
    $iY = $aMouse_Pos[1] - 5

    ; If array full then return
    If $ahFixers[0] = 10 Then Return

    ; Increase counter
    $ahFixers[0] += 1

    ; Create fixer GUI
    $ahFixers[$ahFixers[0]] = GUICreate("", 10, 10, $iX, $iY, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetState(@SW_SHOW, $ahFixers[$ahFixers[0]])

    ; Restore main GUI
    GUISetState(@SW_SHOW, $hGUI)

EndFunc

I hope this is what you wanted. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

your example does work! But when I try to implement it in my script I get this error:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Cas\Desktop\Shared Files\RPixFix.au3"    
C:\Users\Cas\Desktop\Shared Files\PixelFixer.au3 (72) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
GUISetState ( @SW_SHOW, $ahFixers[$ahFixers[0]] )
GUISetState ( @SW_SHOW, ^ ERROR
>Exit code: 1    Time: 1.858

This is my main script:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include "PixelFixer.au3"
#include <ComboConstants.au3>
#Include <Misc.au3>

$Title = "RPixFix"
$Version = "0.4"

$MainGui =                      GUICreate ( $Title & " " & $Version, 300, 200 )
$Tab =                          GUICtrlCreateTab ( 10, 10, 280, 180 )
                                GUICtrlCreateTabItem ( "Pixel Localization" )
                                GUICtrlCreateGroup ( "Static color", 25, 40, 250, 80 )
$BtRed =                        GUICtrlCreateButton ( "Red", 40, 60, 74, 24 )
$BtGreen =                      GUICtrlCreateButton ( "Green", 115, 60, 75, 24 )    
$BtBlue =                       GUICtrlCreateButton ( "Blue", 191, 60, 74, 24 )
$BtBlack =                      GUICtrlCreateButton ( "Black", 40, 85, 112, 24 )
$BtWhite =                      GUICtrlCreateButton ( "White", 153, 85, 112, 24 )

$FocusGroup =                   GUICtrlCreateGroup ( "Cycle colors", 25, 125, 250, 50 )
$ChRed =                        GUICtrlCreateCheckbox ( "Red", 40, 144 )
$ChGreen =                      GUICtrlCreateCheckbox ( "Green", 86, 144 )
$ChBlue =                       GUICtrlCreateCheckbox ( "Blue", 140, 144 )
$RunCycle =                     GUICtrlCreateButton ( "Run", 190, 142, 70, 24 )

                                GUICtrlCreateTabItem ( "Pixel Fixers" )
                                
                                GUICtrlCreateGroup ( "Fixers", 25, 40, 250, 54 )
$FixersCombo =                  GUICtrlCreateCombo ( "", 40, 59, 135, 24, $CBS_DROPDOWNLIST )
$DeleteFixer =                  GUICtrlCreateButton ( "Delete", 180, 58, 80, 23 )
                                GUICtrlCreateGroup ( "New fixer", 25, 99, 250, 76 )
                                GUICtrlCreateLabel ( "W:", 40, 122 )
$PixelWidth =                   GUICtrlCreateInput ( "10", 58, 118, 40 )
$PixelWidthUD =                 GUICtrlCreateUpDown ( $PixelWidth )
                                GUICtrlCreateLabel ( "H:", 108, 122 )
$PixelHeight =                  GUICtrlCreateInput ( "10", 123, 118, 40 )
$PixelHeightUD =                GUICtrlCreateUpDown ( $PixelHeight )
                                GUICtrlCreateLabel ( "Interval:", 170, 122 )
$Interval =                     GUICtrlCreateInput ( "25", 210, 118, 50 )
$IntervalUD =                   GUICtrlCreateUpDown ( $Interval )
                                
                                GUICtrlCreateLabel ( "Method:", 40, 150 )
$MethodSolid =                  GUICtrlCreateRadio ( "Solid", 90, 146 )
$MethodNoise =                  GUICtrlCreateRadio ( "Noise", 140, 146 )
        
$AddNewFixer =                  GUICtrlCreateButton ( "Add", 190, 146, 72, 20 )     
                                GUICtrlCreateTabItem ( "Options" )
                                GUICtrlCreateTabItem ( "About" )
    
                                GUICtrlSetState ( $FocusGroup, $GUI_FOCUS )
                                GUICtrlSetState ( $MethodSolid, $GUI_CHECKED )
                                GUICtrlSetState ( $ChRed, $GUI_CHECKED )
                                GUICtrlSetState ( $ChGreen, $GUI_CHECKED )
                                GUICtrlSetState ( $ChBlue, $GUI_CHECKED )
                                GUISetState ( @SW_SHOW, $MainGui )

While 1
    Switch GUIGetMsg()
        Case $AddNewFixer
            If GUICtrlRead ( $MethodSolid ) = $GUI_CHECKED Then
                createSolidFixer ( GUICtrlRead ( $PixelWidth ), GUICtrlRead ( $PixelHeight ), GUICtrlRead ( $Interval ) )
            ElseIf GUICtrlRead ( $MethodNoise ) = $GUI_CHECKED Then
                
            EndIf
        Case $BtRed
            HotKeySet ( "{ESC}", "deleteLocalizator" )
            createLocalizator ( 0xFF0000 )
        Case $BtGreen
            HotKeySet ( "{ESC}", "deleteLocalizator" )
            createLocalizator ( 0x00FF00 )
        Case $BtBlue
            HotKeySet ( "{ESC}", "deleteLocalizator" )
            createLocalizator ( 0x0000FF )
        Case $BtBlack
            HotKeySet ( "{ESC}", "deleteLocalizator" )
            createLocalizator ( 0x000000 )
        Case $BtWhite
            HotKeySet ( "{ESC}", "deleteLocalizator" )
            createLocalizator ( 0xFFFFFF )
        Case $RunCycle
            HotKeySet ( "{ESC}", "deleteCycle" )
            ConsoleWrite ( " Red " & GUICtrlRead ( $ChRed ) & " Green " &  GUICtrlRead ( $ChGreen ) & " Blue " & GUICtrlRead ( $ChBlue ) )
            createCycle ( GUICtrlRead ( $ChRed ), GUICtrlRead ( $ChGreen ), GUICtrlRead ( $ChBlue ) )
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

#include "PixelFixer.au3"

; Array to hold fixer GUI handles & Fixer GUI colours
Global $ahFixers[11] = [0], $aAllColors[3] = [0xFF0000, 0x00FF00, 0x0000FF]
$iColourCount = 0

Func createLocalizator ( $Color )
    Global $Localizator =   GUICreate ( $Title & " is fixing pixels...", @DesktopWidth+2, @DesktopHeight+100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )
    
    $Label =                GUICtrlCreateLabel ( "", 0, 0, @DesktopWidth+2, @DesktopHeight+100 )
                            GUICtrlSetBkColor ( $Label, $Color )
                            
                            GUISetCursor ( 16, 1 )
                            GUISetState ( @SW_SHOW, $Localizator )
                            
EndFunc

Func deleteLocalizator ( )
    GUISetCursor ( )
    GUIDelete ( $Localizator )
    HotKeySet ( "{ESC}" )
EndFunc

Global $Red = True
Global $Blue = True
Global $Green = True

Func createCycle ( $Red, $Green, $Blue )
    Global $Cycle =         GUICreate ( $Title & " is fixing pixels...", @DesktopWidth+2, @DesktopHeight+100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )
    
    Global $Label =         GUICtrlCreateLabel ( "", 0, 0, @DesktopWidth+2, @DesktopHeight+100 )
                            GUICtrlSetBkColor ( $Label, 0x0000FF )
                            
                            GUISetState ( @SW_SHOW, $Cycle )
                            GUISetCursor ( 16, 1 )
                            
                            AdlibEnable ( "createCycleLib", 1500 )

EndFunc
            
Func createCycleLib ( )
    If $Red = True Then
        GUICtrlSetBkColor ( $Label, 0x00FF00 )
        $Blue = True
        $Red = False
        $Green = False
    ElseIf $Blue = True Then
        GUICtrlSetBkColor ( $Label, 0xFF0000 )
        $Green = True
        $Blue = False
        $Red = False
    ElseIf $Green = True Then
        GUICtrlSetBkColor ( $Label, 0x0000FF )
        $Red = True
        $Blue = False
        $Green = False
    EndIf
EndFunc

Func deleteCycle ( )
    AdlibDisable ( )
    GUISetCursor ( )
    GUIDelete ( $Cycle )
    HotKeySet ( "{ESC}" )
EndFunc

Func createSolidFixer ( $FixerWidth, $FixerHeight, $FixerRefreshMS )
    $ahFixers[$ahFixers[0]] = GUICreate ( $Title & " is fixing pixels...", $FixerWidth, $FixerHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("[CLASS:Progman]") )

    Global $Label =         GUICtrlCreateLabel ( "", 0, 0, $FixerWidth, $FixerHeight, -1, $GUI_WS_EX_PARENTDRAG )
                            GUICtrlSetBkColor ( $Label, 0x000000 )
                            
                            GUISetCursor ( 3, 1 )
                            GUISetState ( @SW_SHOW, $ahFixers[$ahFixers[0]] )
    
                            $ahFixers[0] += 1
                            
                            AdlibEnable ( "createSolidFixerLib", $FixerRefreshMS )
                            If $ahFixers[0] = 10 Then Return

EndFunc

Func createSolidFixerLib ( )
    ; Change colour index, but only between 0, 1, 2
    $iColourCount = Mod($iColourCount + 1, 3)

    ; Change colour for all Fixer GUIs
    For $i = 1 To $ahFixers[0]
        GUISetBkColor($aAllColors[$iColourCount], $ahFixers[$i])
    Next
EndFunc

Share this post


Link to post
Share on other sites

Rawox,

I get a lot more errors than that... ;) But sticking to the question:

In your createSolidFixer function, you run things in this order:

1. Create the next Fixer GUI with $ahFixers[$ahFixers[0]] = GUICreate(...)

2. Increase the count with $ahFixers[0] += 1

3. Check if there are spaces left in the $ahFixers array with If $ahFixers[0] = 10 Then Return

This means that if your array is already full, you will try and fill a non-existent element at the first step and get the error. I would suggest that you reverse the order of these actions in the function, as I did in the example I posted above. :evil:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Thanks, I finally got it working!

But... Is there a way to delete only one of the GUI?

Cause:

$CurrentFixer = StringTrimLeft ( GUICtrlRead ( $FixersCombo ), 11 )
            ConsoleWrite ( "Current Fixer: " & $CurrentFixer & " || " )GUIDelete ( $ahSolidFixers[$CurrentFixer] )

$FixersCombo = a combobox display the different created GUI

EDIT: Stupid me! Working ;)

Edited by Rawox

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  
Followers 0