Sign in to follow this  
Followers 0
Alek

Thinking box

20 posts in this topic

#1 ·  Posted (edited)

CODE
#include <GuiConstants.au3>

Global $gui[100000]
$x = 1

$Mother_GUI = GUICreate("Thinking box",-1,-1,-1,-1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Button_1 = GUICtrlCreateButton("New Box", 5, 5, 70, 20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button_2 = GUICtrlCreateButton("Delete Box",5,30,70,20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Input_1 = GUICtrlCreateInput("1",5,60,70,20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
GUISetState(@SW_SHOW, $Mother_GUI)

$Main_GUI = GUICreate("",220,300,80,5,$WS_POPUPWINDOW)
GUISetBkColor(0xCCCCCC)
GUISetState(@SW_SHOW,$Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Main_GUI), "hwnd", WinGetHandle($Mother_GUI))
Makebox()
While 1
    setsize()
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then Exit
    if $msg = $Button_1 then Makebox()
    if $msg = $Button_2 then GUIDelete($Gui[GUICtrlRead($Input_1)])
    sleep(10)
WEnd

Func Makebox()
    if $x < 100000 then
        $gui[$x] = GUICreate("",200,90,100+$x*5,100+$x*5, $WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
        $label = GUICtrlCreateLabel("  Box number: " & $x,0,0,200,20,-1,$GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont(-1,12,14,0,"Comic Sans MS")
        settopbarcolor()
        GUICtrlCreateEdit("",0,20,200,70,$WS_VSCROLL)
        GUISetState(@SW_SHOW,$gui[$x])
        DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Gui[$x]), "hwnd", WinGetHandle($Main_GUI))
        $x = $x +1
    EndIf
EndFunc

Func settopbarcolor($s_control=-1)
    $Random = Random(1,6,1)
    if $Random = 1 Then
        GUICtrlSetBkColor($s_control,0x0000FF)
    elseif $Random = 2 Then
        GUICtrlSetBkColor($s_control,0x00FF00)
    elseif $Random = 3 then
        GUICtrlSetBkColor($s_control,0xFF0000)
    elseif $Random = 4 then
        GUICtrlSetBkColor($s_control,0x00FFFF)
    elseif $Random = 5 then
        GUICtrlSetBkColor($s_control,0xFF00FF)
    elseif $Random = 6 Then
        GUICtrlSetBkColor($s_control,0xFFFF00)
    EndIf
EndFunc

Func setsize()
    $Motherpos = WinGetPos($Mother_GUI)
    $Mainpos = WinGetPos($Main_GUI)
    if $Mainpos[2] <> $Motherpos[2]-98 or $Mainpos[3] <> $Motherpos[3]-40 then WinMove($Main_GUI,"",85,5,$Motherpos[2]-98,$Motherpos[3]-45)
EndFunc

Func SpecialEvents()
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            Exit
    EndSelect
EndFunc

What is it? its a gui with a button that creates a small moveable editbox inside te larger gui, it helps me figuer out to make stuff.i

i used a smaller version to make this version :)

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites



That's a cool idea, thanks for sharing :)

Share this post


Link to post
Share on other sites

Very, very cool script! :)


My Scripts: SimplePlayer 1.0 - A very simple music player. PCInfo 1.2 - A script that displays PC information.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Wow,this is awesome.Something like this could be great for productivity.I see it as something or a stickypad reminder box,or some sorta taskbox.Excellent example of thinking outside the box,errr maybe inside the box :)

I just opened up 105 boxes out of curiousity to see if there was a small limit.Doesnt seem like theres a limit,up to 105 anyways.Didnt go further.I like the scrollbars on the small boxes as well.I can see something really cool coming out of this idea,great job

Edited by xStylezx

Share this post


Link to post
Share on other sites

Wow... this is incredible. Very simple yet very creative. I love the small boxes and just the shape and color and overall setup of them. Great job!!!


- Dan [Website]

Share this post


Link to post
Share on other sites

You know.. This is similar to a simple OS. :)

Youre right,does seem like that.Look out windows 95 :)

Share this post


Link to post
Share on other sites

woaw, thanks all :rolleyes:


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

I really love it -- inspired too thanks


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

I like the simplicity of the boxes, works really well. Good example :rolleyes:


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

WoW! It's very great script man! :whistle:


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

@Alek, nice work. Great MDI example!

Cheers! :whistle:

Share this post


Link to post
Share on other sites

I have modified a little bit(?) this example, i liked the idea, so here it is:

#include <GuiConstants.au3>

Global $iLimit_Box = 5000
Global $ahBox_GUI[$iLimit_Box]

Global $iBox_Counter = 1
Global $iLeft_Counter = 0
Global $iTopPlus = 20

$hHost_GUI = GUICreate("Thinking box", -1, -1, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GUIRegisterMsg($WM_SIZING, "WM_SIZING")

$Button_1 = GUICtrlCreateButton("New Box", 5, 5, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$Button_2 = GUICtrlCreateButton("Delete Box", 5, 30, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$Input_1 = GUICtrlCreateInput(-1, 5, 60, 70, 20) ;, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUISetState(@SW_SHOW, $hHost_GUI)

$hMain_GUI = GUICreate("", 220, 300, 80, 5, $WS_POPUPWINDOW)
GUISetBkColor(0xCCCCCC)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($hMain_GUI), "hwnd", WinGetHandle($hHost_GUI))

MakeBox()
WM_SIZING($hHost_GUI, 0, 0, 0)

GUISetState(@SW_SHOW, $hMain_GUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
            WM_SIZING($hHost_GUI, 0, 0, 0)
        Case $Button_1
            Makebox()
        Case $Button_2
            $iDelete_Box_Num = Number(GUICtrlRead($Input_1))
            
            If $iDelete_Box_Num = -1 And $iBox_Counter-1 > 0 Then
                GUIDelete($ahBox_GUI[$iBox_Counter-1])
                $iBox_Counter -= 1
                $iLeft_Counter -= 1
            ElseIf $iDelete_Box_Num <= $iBox_Counter And $iDelete_Box_Num > 0 Then
                GUIDelete($ahBox_GUI[$iDelete_Box_Num])
            EndIf
    EndSwitch
WEnd

Func MakeBox()
    If $iBox_Counter >= $iLimit_Box Then
        MsgBox(48, "Error", StringFormat("Number of allowed Boxes is limited to [%i]", $iLimit_Box))
        Return
    EndIf
    
    $aHostGUI_Pos = WinGetPos($hHost_GUI)
    $iLeft_Counter += 1
    
    If 250 + $iLeft_Counter * 6 > $aHostGUI_Pos[2] Then
        $iLeft_Counter = 1
        $iTopPlus -= 20
        If $iTopPlus < 0 Then $iTopPlus = 60
    EndIf
    
    Local $iLeft = 40 + $iLeft_Counter * 6
    Local $iTop = $iTopPlus + $iLeft_Counter * 6
    
    $ahBox_GUI[$iBox_Counter] = GUICreate("", 200, 90, $iLeft, $iTop, BitOR($WS_POPUPWINDOW, $WS_SIZEBOX), $WS_EX_TOOLWINDOW)
    
    GUICtrlCreateLabel("Box Number: " & $iBox_Counter, 0, 0, 200, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 14, 0, "Comic Sans MS")
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
    
    Local $aColors[6] = [0x0000FF, 0x00FF00, 0xFF0000, 0x00FFFF, 0xFF00FF, 0xFFFF00]
    GUICtrlSetBkColor(-1, $aColors[Random(0, 5, 1)])
    
    GUICtrlCreateEdit("", 0, 20, 200, 70, BitOr($GUI_SS_DEFAULT_EDIT, $WS_VSCROLL))
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    
    DllCall("user32.dll", "int", "SetParent", "hwnd", _
        WinGetHandle($ahBox_GUI[$iBox_Counter]), "hwnd", WinGetHandle($hMain_GUI))
    
    GUISetState(@SW_SHOW, $ahBox_GUI[$iBox_Counter])
    
    $iBox_Counter += 1
EndFunc

Func WM_SIZING($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $hHost_GUI Then Return
    
    Local $aHostGUI_Pos = WinGetPos($hHost_GUI)
    If @error Then Return
    
    Local $aMainGUI_Pos = WinGetPos($hMain_GUI)
    If @error Then Return
    
    If $aMainGUI_Pos[2] <> $aHostGUI_Pos[2] - 98 Or $aMainGUI_Pos[3] <> $aMainGUI_Pos[3] - 40 Then _
        WinMove($hMain_GUI, "", 85, 5, $aHostGUI_Pos[2] - 98, $aHostGUI_Pos[3] - 45)
EndFunc

Changes:

* -1 in the input says to «Delete Box» button to delete last box muttley

* Boxes are resizable now.

* SetSize() functionality now used in WM_SIZING message function.

* SetTopBarColor() removed, it's now used directly in MakeBox() function (shorten version).

* General improvements and fixes.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Nice.

Is it just me or...? I had to include the following

#Include <WindowsConstants.au3>
#include <StaticConstants.Au3>
#include <EditConstants.au3>
Edited by DaRam

Share this post


Link to post
Share on other sites

Wow, I can't believe I didn't see this before! This is really cool.

By the way, If you put the number of a box that doesn't exist and try to delete it, it crashes.

Also, how about a button so the you type the number, then press a button to go to that number box.

Also, It would be cool if the number changed when you click on a new box.

I know these aren't easy, they're just suggestions.

Great job once again!


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <GUIEdit.au3>

Global Const $SS_CENTER = 0x01

Global $iLimit_Box = 5000
Global $ahBox_GUI[$iLimit_Box]

Global $iBox_Counter = 1
Global $iLeft_Counter = 0
Global $iTopPlus = 20

$hHost_GUI = GUICreate("Thinking box", -1, -1, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GUIRegisterMsg($WM_SIZING, "WM_SIZING")

$Button_1 = GUICtrlCreateButton("New Box", 5, 5, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$Button_2 = GUICtrlCreateButton("Delete Box", 5, 30, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$Input_1 = GUICtrlCreateInput(-1, 5, 60, 70, 20);, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUISetState(@SW_SHOW, $hHost_GUI)

$hMain_GUI = GUICreate("", 220, 300, 80, 5, $WS_POPUPWINDOW)
GUISetBkColor(0xCCCCCC)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($hMain_GUI), "hwnd", WinGetHandle($hHost_GUI))

MakeBox()
WM_SIZING($hHost_GUI, 0, 0, 0)

GUISetState(@SW_SHOW, $hMain_GUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
            WM_SIZING($hHost_GUI, 0, 0, 0)
        Case $Button_1
            Makebox()
        Case $Button_2
            $iDelete_Box_Num = Number(GUICtrlRead($Input_1))
           
            If $iDelete_Box_Num = -1 And $iBox_Counter-1 > 0 Then
                GUIDelete($ahBox_GUI[$iBox_Counter-1])
                $iBox_Counter -= 1
                $iLeft_Counter -= 1
            ElseIf $iDelete_Box_Num <= $iBox_Counter And $iDelete_Box_Num > 0 Then
                GUIDelete($ahBox_GUI[$iDelete_Box_Num])
            EndIf
    EndSwitch
WEnd

Func MakeBox()
    If $iBox_Counter >= $iLimit_Box Then
        MsgBox(48, "Error", StringFormat("Number of allowed Boxes is limited to [%i]", $iLimit_Box))
        Return
    EndIf
   
    $aHostGUI_Pos = WinGetPos($hHost_GUI)
    $iLeft_Counter += 1
   
    If 250 + $iLeft_Counter * 6 > $aHostGUI_Pos[2] Then
        $iLeft_Counter = 1
        $iTopPlus -= 20
        If $iTopPlus < 0 Then $iTopPlus = 60
    EndIf
   
    Local $iLeft = 40 + $iLeft_Counter * 6
    Local $iTop = $iTopPlus + $iLeft_Counter * 6
   
    $ahBox_GUI[$iBox_Counter] = GUICreate("", 200, 90, $iLeft, $iTop, BitOR($WS_POPUPWINDOW, $WS_SIZEBOX), $WS_EX_TOOLWINDOW)
   
    GUICtrlCreateLabel("Box Number: " & $iBox_Counter, 0, 0, 200, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 14, 0, "Comic Sans MS")
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
   
    Local $aColors[6] = [0x0000FF, 0x00FF00, 0xFF0000, 0x00FFFF, 0xFF00FF, 0xFFFF00]
    GUICtrlSetBkColor(-1, $aColors[Random(0, 5, 1)])
   
    GUICtrlCreateEdit("", 0, 20, 200, 70, BitOr($GUI_SS_DEFAULT_EDIT, $WS_VSCROLL))
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
   
    DllCall("user32.dll", "int", "SetParent", "hwnd", _
        WinGetHandle($ahBox_GUI[$iBox_Counter]), "hwnd", WinGetHandle($hMain_GUI))
   
    GUISetState(@SW_SHOW, $ahBox_GUI[$iBox_Counter])
   
    $iBox_Counter += 1
EndFunc

Func WM_SIZING($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $hHost_GUI Then Return
   
    Local $aHostGUI_Pos = WinGetPos($hHost_GUI)
    If @error Then Return
   
    Local $aMainGUI_Pos = WinGetPos($hMain_GUI)
    If @error Then Return
   
    If $aMainGUI_Pos[2] <> $aHostGUI_Pos[2] - 98 Or $aMainGUI_Pos[3] <> $aMainGUI_Pos[3] - 40 Then _
        WinMove($hMain_GUI, "", 85, 5, $aHostGUI_Pos[2] - 98, $aHostGUI_Pos[3] - 45)
EndFunc

Fixed for latest version muttley

Share this post


Link to post
Share on other sites

I had to include the following

Yes you are right, it's just that i still use 3.2.8.1 as my main version muttley.

If you put the number of a box that doesn't exist and try to delete it, it crashes

Not in the last modified version :(

Also, how about a button so the you type the number, then press a button to go to that number box.

Also, It would be cool if the number changed when you click on a new box.

Done:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>

Global $iLimit_Box = 5000
Global $ahBox_GUI[1][1]

Global $sBoxTitle = "Box Number: %i"
Global $iFocusBox = False

Global $iLeft_Counter = 0
Global $iTopPlus = 20

$hHost_GUI = GUICreate("Thinking box", -1, -1, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

$NewBox_Button = GUICtrlCreateButton("New Box", 5, 5, 70, 20, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$DeleteBox_Button = GUICtrlCreateButton("Delete Box", 5, 40, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$DeleteBox_Input = GUICtrlCreateInput(-1, 5, 65, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$GoToBox_Button = GUICtrlCreateButton("Go To Box", 5, 100, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

$GoToBox_Input = GUICtrlCreateInput(-1, 5, 125, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUISetState(@SW_SHOW, $hHost_GUI)

$hMain_GUI = GUICreate("", 220, 300, 80, 5, $WS_POPUPWINDOW)
GUISetBkColor(0xCCCCCC)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($hMain_GUI), "hwnd", WinGetHandle($hHost_GUI))

MakeBox_Proc()
WM_SIZING($hHost_GUI, 0, 0, 0)

GUISetState(@SW_SHOW, $hMain_GUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
            WM_SIZING($hHost_GUI, 0, 0, 0)
        Case $NewBox_Button
            MakeBox_Proc()
        Case $DeleteBox_Button
            DeleteBox_Proc()
        Case $GoToBox_Button
            GoToBox_Proc()
    EndSwitch
WEnd

Func MakeBox_Proc()
    If $ahBox_GUI[0][0] >= $iLimit_Box Then
        MsgBox(48, "Error", StringFormat("Number of allowed Boxes is limited to [%i]", $iLimit_Box))
        Return
    EndIf
    
    Local $aHostGUI_Pos = WinGetPos($hHost_GUI)
    
    $iLeft_Counter += 1
    
    If 250 + $iLeft_Counter * 6 > $aHostGUI_Pos[2] Then
        $iLeft_Counter = 1
        $iTopPlus -= 20
        If $iTopPlus < 0 Then $iTopPlus = 60
    EndIf
    
    Local $iLeft = 40 + $iLeft_Counter * 6
    Local $iTop = $iTopPlus + $iLeft_Counter * 6
    
    $ahBox_GUI[0][0] += 1
    ReDim $ahBox_GUI[$ahBox_GUI[0][0]+1][2]
    
    $ahBox_GUI[$ahBox_GUI[0][0]][0] = GUICreate("", 200, 90, $iLeft, $iTop, BitOR($WS_POPUPWINDOW, $WS_SIZEBOX), $WS_EX_TOOLWINDOW)
    $ahBox_GUI[$ahBox_GUI[0][0]][1] = StringFormat($sBoxTitle, $ahBox_GUI[0][0])
    
    GUICtrlCreateLabel($ahBox_GUI[$ahBox_GUI[0][0]][1], 0, 0, 200, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 14, 0, "Comic Sans MS")
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
    
    Local $aColors[6] = [0x0000FF, 0x00FF00, 0xFF0000, 0x00FFFF, 0xFF00FF, 0xFFFF00]
    GUICtrlSetBkColor(-1, $aColors[Random(0, 5, 1)])
    
    GUICtrlCreateEdit("", 0, 20, 200, 70, BitOr($GUI_SS_DEFAULT_EDIT, $WS_VSCROLL))
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    
    DllCall("user32.dll", "int", "SetParent", "hwnd", _
        WinGetHandle($ahBox_GUI[$ahBox_GUI[0][0]][0]), "hwnd", WinGetHandle($hMain_GUI))
    
    GUISetState(@SW_SHOW, $ahBox_GUI[$ahBox_GUI[0][0]][0])
    
    GUICtrlSetData($DeleteBox_Input, $ahBox_GUI[0][0])
    If Not $iFocusBox Then ControlFocus($hHost_GUI, "", $NewBox_Button)
EndFunc

Func DeleteBox_Proc()
    Local $iDelete_Box_Num = Number(GUICtrlRead($DeleteBox_Input))
    
    If $ahBox_GUI[0][0] = 0 Or $iDelete_Box_Num = 0 Then Return SetError(1, 0, 0)
    
    $iLeft_Counter -= 1
    
    Switch $iDelete_Box_Num
        Case -1
            $ahBox_GUI[0][0] -= 1
            ReDim $ahBox_GUI[$ahBox_GUI[0][0]+2][2]
            GUIDelete($ahBox_GUI[$ahBox_GUI[0][0]+1][0])
        Case Else
            Local $aTmpArr[1][1]
            Local $sBoxTitleFormat = StringFormat($sBoxTitle, $iDelete_Box_Num)
            
            For $i = 1 To $ahBox_GUI[0][0]
                If $ahBox_GUI[$i][1] = $sBoxTitleFormat Then
                    GUIDelete($ahBox_GUI[$i][0])
                Else
                    $aTmpArr[0][0] += 1
                    ReDim $aTmpArr[$aTmpArr[0][0]+1][2]
                    $aTmpArr[$aTmpArr[0][0]][0] = $ahBox_GUI[$i][0]
                    $aTmpArr[$aTmpArr[0][0]][1] = $ahBox_GUI[$i][1]
                EndIf
            Next
            
            $ahBox_GUI = $aTmpArr
    EndSwitch
    
    GUICtrlSetData($DeleteBox_Input, -1)
EndFunc

Func GoToBox_Proc()
    Local $iGoTo_Box_Num = Number(GUICtrlRead($GoToBox_Input))
    
    If $ahBox_GUI[0][0] = 0 Or $iGoTo_Box_Num = 0 Then Return SetError(1, 0, 0)
    
    Switch $iGoTo_Box_Num
        Case -1
            ControlFocus($ahBox_GUI[$ahBox_GUI[0][0]][0], "", "")
        Case Else
            Local $sBoxTitleFormat = StringFormat($sBoxTitle, $iGoTo_Box_Num)
            Local $iGoToFound = 0
            
            For $i = 1 To $ahBox_GUI[0][0]
                If $ahBox_GUI[$i][1] = $sBoxTitleFormat Then
                    $iGoToFound = 1
                    ControlFocus($ahBox_GUI[$i][0], "", "")
                    ExitLoop
                EndIf
            Next
            
            If Not $iGoToFound Then
                ControlFocus($ahBox_GUI[$ahBox_GUI[0][0]][0], "", "")
                $iGoTo_Box_Num = -1
            EndIf
            
            GUICtrlSetData($GoToBox_Input, $iGoTo_Box_Num)
    EndSwitch
    
    GUICtrlSetData($DeleteBox_Input, $iGoTo_Box_Num)
EndFunc

Func WM_SIZING($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $hHost_GUI Then Return
    
    Local $aHostGUI_Pos = WinGetPos($hHost_GUI)
    If @error Then Return
    
    Local $aMainGUI_Pos = WinGetPos($hMain_GUI)
    If @error Then Return
    
    If $aMainGUI_Pos[2] <> $aHostGUI_Pos[2] - 98 Or $aMainGUI_Pos[3] <> $aMainGUI_Pos[3] - 40 Then _
        WinMove($hMain_GUI, "", 85, 5, $aHostGUI_Pos[2] - 98, $aHostGUI_Pos[3] - 45)
EndFunc

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $MINGuiX = 100
    Local $MINGuiY = 80
    ;Local $MAXGuiX = 600
    ;Local $MAXGuiY = 600
    
    Local $MinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    
    DllStructSetData($MinMaxInfo, 7, $MINGuiX) ; min X
    DllStructSetData($MinMaxInfo, 8, $MINGuiY) ; min Y
    ;DllStructSetData($MinMaxInfo, 9, $MAXGuiX) ; max X
    ;DllStructSetData($MinMaxInfo, 10, $MAXGuiY) ; max Y
    
    Return $GUI_RUNDEFMSG
EndFunc

Plus...

* Restriction on the windows size (100 x 80).

* Dynamic array with GUI handles.

* No focus on the box when it's created (optional).

* And some more minor fixes :).


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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