Jump to content

Creating a grid


Recommended Posts

Hi,

I'm trying to create in grid in my gui (9x11) and I dont know wich command should I use. I made seven buttons with images on them and I want that when you click on a button, you can drag a copy of the image(that was on the button) to the desire square in the grid and stick it there. Can anyone help me?

Here's what I have done so far:

#include <GuiConstants.au3>

GuiCreate("My Grid", 515, 471,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_8 = GuiCtrlCreateLabel("Flowers", 400, 13, 150, 20)
$Button_1 = GuiCtrlCreateButton("", 350, 30, 35, 35, $BS_BITMAP)
$Button_2 = GuiCtrlCreateButton("", 387, 30, 35, 35, $BS_BITMAP)
$Button_3 = GuiCtrlCreateButton("", 424, 30, 35, 35, $BS_BITMAP)
$Button_4 = GuiCtrlCreateButton("", 461, 30, 35, 35, $BS_BITMAP)
$Button_5 = GuiCtrlCreateButton("", 369, 67, 35, 35, $BS_BITMAP)
$Button_6 = GuiCtrlCreateButton("", 406, 67, 35, 35, $BS_BITMAP)
$Button_7 = GuiCtrlCreateButton("", 443, 67, 35, 35, $BS_BITMAP)

GUICtrlSetImage($Button_1, @ScriptDir & "\Images\flower1.bmp")
GUICtrlSetImage($Button_2, @ScriptDir & "\Images\flower2.bmp")
GUICtrlSetImage($Button_3, @ScriptDir & "\Images\flower3.bmp")
GUICtrlSetImage($Button_4, @ScriptDir & "\Images\flower4.bmp")
GUICtrlSetImage($Button_5, @ScriptDir & "\Images\flower5.bmp")
GUICtrlSetImage($Button_6, @ScriptDir & "\Images\flower6.bmp")
GUICtrlSetImage($Button_7, @ScriptDir & "\Images\flower7.bmp")

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Button_1
        
    EndSelect
WEnd
Exit
Edited by J0ker
Link to comment
Share on other sites

Thanks for this Valuater but I dont want to move the control but I just want the image on it to appear when my cursor will reach the grid and be able to drag it on the grid.

Edited by J0ker
Link to comment
Share on other sites

Well, perhaps look over my "Football PlayMaker" script (in sig). Long story short: it can move the controls while the user clicks on it, it also provides "walls" so players from opposite teams cannot go to the same side.

Good luck,

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

Thanks Kurt, that might help me. Do you have any idea on how I could make a dynamic grid?

Do a search of Example scripts for Grid. Someone has already scripted it.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

how I could make a dynamic grid?

I maded some grid here, i don't sure if this is what you need, but you can try it :whistle:

 

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

Link to comment
Share on other sites

Thanks, i think i will use it. How can I use so I would be able to drag image on the grid?

I made a grid but I dont know if it's better then yours:

#include <GUIConstants.au3>


Global Const $GRID_WIDTH = 9
Global Const $GRID_HEIGHT = 11
Global $g_lblGameBoard[$GRID_WIDTH][$GRID_HEIGHT]

GUICreate("My Grid", 490, 560)

_MakeTheGrid()

GUISetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    ;Case
    EndSelect
WEnd
GUIDelete()

Func _MakeTheGrid()
    Local $i, $j
    Local $x, $y
    
    $x = 20
    $y = 20
    For $i = 0 To $GRID_WIDTH-1
        For $j = 0 To $GRID_HEIGHT-1
            GUICtrlCreateLabel("", $x, $y, 25, 25, $SS_BLACKFRAME)
            $g_lblGameBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
            GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
            $y = $y+26
        Next
        $x = $x+26
        $y = 20
    Next
EndFunc

I also dont know if I will be able to manipulate it.

Edited by J0ker
Link to comment
Share on other sites

Ok Finally, I got my grid + my buttons.

Here's what Im trying to do now:

When you click on a button and you click in a square of the grid, the same image that was on the button paste in the square.

1. You click the button with the image on it

2. You click on a square of the grid

3. The same image that was on the button appear in the square and stay there.

That way you can fill the grid with all the images.

#include <GuiConstants.au3>

GuiCreate("My Grid", 515, 500,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_8 = GuiCtrlCreateLabel("Flowers", 400, 13, 150, 20)
$Button_1 = GuiCtrlCreateButton("", 350, 30, 35, 35, $BS_BITMAP)
$Button_2 = GuiCtrlCreateButton("", 387, 30, 35, 35, $BS_BITMAP)
$Button_3 = GuiCtrlCreateButton("", 424, 30, 35, 35, $BS_BITMAP)
$Button_4 = GuiCtrlCreateButton("", 461, 30, 35, 35, $BS_BITMAP)
$Button_5 = GuiCtrlCreateButton("", 369, 67, 35, 35, $BS_BITMAP)
$Button_6 = GuiCtrlCreateButton("", 406, 67, 35, 35, $BS_BITMAP)
$Button_7 = GuiCtrlCreateButton("", 443, 67, 35, 35, $BS_BITMAP)

GUICtrlSetImage($Button_1, @ScriptDir & "\Images\flower1.bmp")
GUICtrlSetImage($Button_2, @ScriptDir & "\Images\flower2.bmp")
GUICtrlSetImage($Button_3, @ScriptDir & "\Images\flower3.bmp")
GUICtrlSetImage($Button_4, @ScriptDir & "\Images\flower4.bmp")
GUICtrlSetImage($Button_5, @ScriptDir & "\Images\flower5.bmp")
GUICtrlSetImage($Button_6, @ScriptDir & "\Images\flower6.bmp")
GUICtrlSetImage($Button_7, @ScriptDir & "\Images\flower7.bmp")


; The Grid

;Line 1 (110)
$Label_1 = GuiCtrlCreateLabel("", 9, 110, 35, 35, $SS_BLACKFRAME)
$Label_2 = GuiCtrlCreateLabel("", 43, 110, 35, 35, $SS_BLACKFRAME)
$Label_3 = GuiCtrlCreateLabel("", 77, 110, 35, 35, $SS_BLACKFRAME)
$Label_4 = GuiCtrlCreateLabel("", 111, 110, 35, 35, $SS_BLACKFRAME)
$Label_5 = GuiCtrlCreateLabel("", 145, 110, 35, 35, $SS_BLACKFRAME)
$Label_6 = GuiCtrlCreateLabel("", 179, 110, 35, 35, $SS_BLACKFRAME)
$Label_7 = GuiCtrlCreateLabel("", 213, 110, 35, 35, $SS_BLACKFRAME)
$Label_8 = GuiCtrlCreateLabel("", 247, 110, 35, 35, $SS_BLACKFRAME)
$Label_9 = GuiCtrlCreateLabel("", 281, 110, 35, 35, $SS_BLACKFRAME)

;Line 2 (144)
$Label_10 = GuiCtrlCreateLabel("", 9, 144, 35, 35, $SS_BLACKFRAME)
$Label_11 = GuiCtrlCreateLabel("", 43, 144, 35, 35, $SS_BLACKFRAME)
$Label_12 = GuiCtrlCreateLabel("", 77, 144, 35, 35, $SS_BLACKFRAME)
$Label_13 = GuiCtrlCreateLabel("", 111, 144, 35, 35, $SS_BLACKFRAME)
$Label_14 = GuiCtrlCreateLabel("", 145, 144, 35, 35, $SS_BLACKFRAME)
$Label_15 = GuiCtrlCreateLabel("", 179, 144, 35, 35, $SS_BLACKFRAME)
$Label_16 = GuiCtrlCreateLabel("", 213, 144, 35, 35, $SS_BLACKFRAME)
$Label_17 = GuiCtrlCreateLabel("", 247, 144, 35, 35, $SS_BLACKFRAME)
$Label_18 = GuiCtrlCreateLabel("", 281, 144, 35, 35, $SS_BLACKFRAME)

;Line 3 (178)
$Label_19 = GuiCtrlCreateLabel("", 9, 178, 35, 35, $SS_BLACKFRAME)
$Label_20 = GuiCtrlCreateLabel("", 43, 178, 35, 35, $SS_BLACKFRAME)
$Label_21 = GuiCtrlCreateLabel("", 77, 178, 35, 35, $SS_BLACKFRAME)
$Label_22 = GuiCtrlCreateLabel("", 111, 178, 35, 35, $SS_BLACKFRAME)
$Label_23 = GuiCtrlCreateLabel("", 145, 178, 35, 35, $SS_BLACKFRAME)
$Label_24 = GuiCtrlCreateLabel("", 179, 178, 35, 35, $SS_BLACKFRAME)
$Label_25 = GuiCtrlCreateLabel("", 213, 178, 35, 35, $SS_BLACKFRAME)
$Label_26 = GuiCtrlCreateLabel("", 247, 178, 35, 35, $SS_BLACKFRAME)
$Label_27 = GuiCtrlCreateLabel("", 281, 178, 35, 35, $SS_BLACKFRAME)

;Line 4 (212)
$Label_28 = GuiCtrlCreateLabel("", 9, 212, 35, 35, $SS_BLACKFRAME)
$Label_29 = GuiCtrlCreateLabel("", 43, 212, 35, 35, $SS_BLACKFRAME)
$Label_30 = GuiCtrlCreateLabel("", 77, 212, 35, 35, $SS_BLACKFRAME)
$Label_31 = GuiCtrlCreateLabel("", 111, 212, 35, 35, $SS_BLACKFRAME)
$Label_32 = GuiCtrlCreateLabel("", 145, 212, 35, 35, $SS_BLACKFRAME)
$Label_33 = GuiCtrlCreateLabel("", 179, 212, 35, 35, $SS_BLACKFRAME)
$Label_34 = GuiCtrlCreateLabel("", 213, 212, 35, 35, $SS_BLACKFRAME)
$Label_35 = GuiCtrlCreateLabel("", 247, 212, 35, 35, $SS_BLACKFRAME)
$Label_36 = GuiCtrlCreateLabel("", 281, 212, 35, 35, $SS_BLACKFRAME)

;Line 5 (246)
$Label_37 = GuiCtrlCreateLabel("", 9, 246, 35, 35, $SS_BLACKFRAME)
$Label_38 = GuiCtrlCreateLabel("", 43, 246, 35, 35, $SS_BLACKFRAME)
$Label_39 = GuiCtrlCreateLabel("", 77, 246, 35, 35, $SS_BLACKFRAME)
$Label_40 = GuiCtrlCreateLabel("", 111, 246, 35, 35, $SS_BLACKFRAME)
$Label_41 = GuiCtrlCreateLabel("", 145, 246, 35, 35, $SS_BLACKFRAME)
$Label_42 = GuiCtrlCreateLabel("", 179, 246, 35, 35, $SS_BLACKFRAME)
$Label_43 = GuiCtrlCreateLabel("", 213, 246, 35, 35, $SS_BLACKFRAME)
$Label_44 = GuiCtrlCreateLabel("", 247, 246, 35, 35, $SS_BLACKFRAME)
$Label_45 = GuiCtrlCreateLabel("", 281, 246, 35, 35, $SS_BLACKFRAME)

;Line 6 (280)
$Label_46 = GuiCtrlCreateLabel("", 9, 280, 35, 35, $SS_BLACKFRAME)
$Label_47 = GuiCtrlCreateLabel("", 43, 280, 35, 35, $SS_BLACKFRAME)
$Label_48 = GuiCtrlCreateLabel("", 77, 280, 35, 35, $SS_BLACKFRAME)
$Label_49 = GuiCtrlCreateLabel("", 111, 280, 35, 35, $SS_BLACKFRAME)
$Label_50 = GuiCtrlCreateLabel("", 145, 280, 35, 35, $SS_BLACKFRAME)
$Label_51 = GuiCtrlCreateLabel("", 179, 280, 35, 35, $SS_BLACKFRAME)
$Label_52 = GuiCtrlCreateLabel("", 213, 280, 35, 35, $SS_BLACKFRAME)
$Label_53 = GuiCtrlCreateLabel("", 247, 280, 35, 35, $SS_BLACKFRAME)
$Label_54 = GuiCtrlCreateLabel("", 281, 280, 35, 35, $SS_BLACKFRAME)

;Line 7 (314)
$Label_55 = GuiCtrlCreateLabel("", 9, 314, 35, 35, $SS_BLACKFRAME)
$Label_56 = GuiCtrlCreateLabel("", 43, 314, 35, 35, $SS_BLACKFRAME)
$Label_57 = GuiCtrlCreateLabel("", 77, 314, 35, 35, $SS_BLACKFRAME)
$Label_58 = GuiCtrlCreateLabel("", 111, 314, 35, 35, $SS_BLACKFRAME)
$Label_59 = GuiCtrlCreateLabel("", 145, 314, 35, 35, $SS_BLACKFRAME)
$Label_60 = GuiCtrlCreateLabel("", 179, 314, 35, 35, $SS_BLACKFRAME)
$Label_61 = GuiCtrlCreateLabel("", 213, 314, 35, 35, $SS_BLACKFRAME)
$Label_62 = GuiCtrlCreateLabel("", 247, 314, 35, 35, $SS_BLACKFRAME)
$Label_63 = GuiCtrlCreateLabel("", 281, 314, 35, 35, $SS_BLACKFRAME)

;Line 8 (348)
$Label_64 = GuiCtrlCreateLabel("", 9, 348, 35, 35, $SS_BLACKFRAME)
$Label_65 = GuiCtrlCreateLabel("", 43, 348, 35, 35, $SS_BLACKFRAME)
$Label_66 = GuiCtrlCreateLabel("", 77, 348, 35, 35, $SS_BLACKFRAME)
$Label_67 = GuiCtrlCreateLabel("", 111, 348, 35, 35, $SS_BLACKFRAME)
$Label_68 = GuiCtrlCreateLabel("", 145, 348, 35, 35, $SS_BLACKFRAME)
$Label_69 = GuiCtrlCreateLabel("", 179, 348, 35, 35, $SS_BLACKFRAME)
$Label_70 = GuiCtrlCreateLabel("", 213, 348, 35, 35, $SS_BLACKFRAME)
$Label_71 = GuiCtrlCreateLabel("", 247, 348, 35, 35, $SS_BLACKFRAME)
$Label_72 = GuiCtrlCreateLabel("", 281, 348, 35, 35, $SS_BLACKFRAME)

;Line 9 (382)
$Label_73 = GuiCtrlCreateLabel("", 9, 382, 35, 35, $SS_BLACKFRAME)
$Label_74 = GuiCtrlCreateLabel("", 43, 382, 35, 35, $SS_BLACKFRAME)
$Label_75 = GuiCtrlCreateLabel("", 77, 382, 35, 35, $SS_BLACKFRAME)
$Label_76 = GuiCtrlCreateLabel("", 111, 382, 35, 35, $SS_BLACKFRAME)
$Label_77 = GuiCtrlCreateLabel("", 145, 382, 35, 35, $SS_BLACKFRAME)
$Label_78 = GuiCtrlCreateLabel("", 179, 382, 35, 35, $SS_BLACKFRAME)
$Label_79 = GuiCtrlCreateLabel("", 213, 382, 35, 35, $SS_BLACKFRAME)
$Label_80 = GuiCtrlCreateLabel("", 247, 382, 35, 35, $SS_BLACKFRAME)
$Label_81 = GuiCtrlCreateLabel("", 281, 382, 35, 35, $SS_BLACKFRAME)

;Line 10 (416)
$Label_82 = GuiCtrlCreateLabel("", 9, 416, 35, 35, $SS_BLACKFRAME)
$Label_83 = GuiCtrlCreateLabel("", 43, 416, 35, 35, $SS_BLACKFRAME)
$Label_77 = GuiCtrlCreateLabel("", 77, 416, 35, 35, $SS_BLACKFRAME)
$Label_85 = GuiCtrlCreateLabel("", 111, 416, 35, 35, $SS_BLACKFRAME)
$Label_86 = GuiCtrlCreateLabel("", 145, 416, 35, 35, $SS_BLACKFRAME)
$Label_87 = GuiCtrlCreateLabel("", 179, 416, 35, 35, $SS_BLACKFRAME)
$Label_88 = GuiCtrlCreateLabel("", 213, 416, 35, 35, $SS_BLACKFRAME)
$Label_89 = GuiCtrlCreateLabel("", 247, 416, 35, 35, $SS_BLACKFRAME)
$Label_90 = GuiCtrlCreateLabel("", 281, 416, 35, 35, $SS_BLACKFRAME)

;Line 11 (450)
$Label_91 = GuiCtrlCreateLabel("", 9, 450, 35, 35, $SS_BLACKFRAME)
$Label_92 = GuiCtrlCreateLabel("", 43, 450, 35, 35, $SS_BLACKFRAME)
$Label_93 = GuiCtrlCreateLabel("", 77, 450, 35, 35, $SS_BLACKFRAME)
$Label_94 = GuiCtrlCreateLabel("", 111, 450, 35, 35, $SS_BLACKFRAME)
$Label_95 = GuiCtrlCreateLabel("", 145, 450, 35, 35, $SS_BLACKFRAME)
$Label_96 = GuiCtrlCreateLabel("", 179, 450, 35, 35, $SS_BLACKFRAME)
$Label_97 = GuiCtrlCreateLabel("", 213, 450, 35, 35, $SS_BLACKFRAME)
$Label_98 = GuiCtrlCreateLabel("", 247, 450, 35, 35, $SS_BLACKFRAME)
$Label_99 = GuiCtrlCreateLabel("", 281, 450, 35, 35, $SS_BLACKFRAME)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Button_1
        
    EndSelect
WEnd
Exit

How can I do that?

Maybe I could use _ControlHover that Valuater made and do something like. If the mouse is over a certain label (square in the grid) and a flower button was pressed then copy the image in the square. I will need help coding this.

Edited by J0ker
Link to comment
Share on other sites

It really isn't very hard. I suppose you could use _ControlHover, but it's quite simple to do it yourself. For starters, you can use GUIGetCursorInfo() to retrieve all necessary information. Include this in your While loop & compare each value from the array.

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

You don't need a label, you're probably looking for GUICtrlCreatePic. I'd use something like this:

;;;; START OF SCRIPT ;;;;
$pic = GUICtrlCreatePic("", $left, $top, $width, $height) ;We do not pick a picture filename, we simply leave it blank for now
;;;; END START OF SCRIPT ;;;;

While 1
;;;
WEnd

Func ChangePic($filename)
    GUICtrlDelete($pic)
    $pic = GUICtrlCreatePic($filename, $left, $top, $width, $height)
EndFunc

Kurt

EDIT: spelling mistake

Kurt

Edited by _Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

I tried using GUICtrlCreatePic with the coordinate of the square in my grid, but if I use that method I wont be able to use a variable later to check if a square in my grid is full.

I need to be able to get the data of the grid later in my script. : ex Square A4 is full with the Flowers4.bmp image.

At first the user fill the grid with images and then I need to be able to see where he places each images and do something link to that. It's why I needed an dynamic grid to be able to get data from the grid.

EDIT:

I could make a grid with blank GUICtrlCreatePic and then the images will change when the user decide to. Sound like a good idea, I will work on it !

Edited by J0ker
Link to comment
Share on other sites

How can i detect when a GUICtrlCreatePic (picture) is clicked?

$Button_1 = GuiCtrlCreateButton("", 350, 30, 35, 35, $BS_BITMAP)

GUICtrlSetImage($Button_1, @ScriptDir & "\Images\flower1.bmp")

$Label_1 = GuiCtrlCreatePic(@ScriptDir & "\Images\blank.bmp", 9, 110, 35, 35)


While 1
    
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $File1 = @ScriptDir & "\Images\flower1.bmp"
    Case $msg = $Label_1
        GuiCtrlCreatePic($File1, 9, 110, 35, 35)

    EndSelect
WEnd
Exit

This work, but it take like 3-4 clicks on the image before it change, do you know why?

EDIT:

What happen is that the image doesnt change, it just put an new image on top of the other. It's why I need 2 clicks to see it. I have to set it so it delete the last image before changing

Edited by J0ker
Link to comment
Share on other sites

Well, If you just want to detect clicks on the control, use this..

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Pic
            Msgbox(0,"","CLICKED")
    EndSelect
WEndoÝ÷ Øz0z÷«ü¨¹ªÞ$x¢»(ëax-¡ÚÚ©©vº)¶¢{[kÊØb±«­¢+Ø)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%M±Ð($%
ÍÀÌØíµÍôÀÌØíA¥($$($$$%M±À ÄÀ¤($$$$ÀÌØíÕÉͽÈôU%Ñ
ÕÉͽÉ%¹¼ ¤($$$$íQ¡½±±½Ý¥¹¥ÌÕÍ%e=T]9PQ

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

Hehe, a little bit too late Saunders :shocked: thx!

Last question and Im out for the night !

I use this to detect when it click the first square of my grid:

Case $msg = $Label_1
        GuiCtrlSetImage($Label_1, $File1)
oÝ÷ Ø&§"f¤zÊ&zØbajÜ"W(§+aÇè®Ø^¢Ø^¯ßlªæ«zæÊ
âw­­«âh·*^Û*¹ªÞo+*¹ªÞÙmN§{Z­æ®¶­s` 66Rb33c¶×6rÒb33c´Æ&VÅó  wV7G&Å6WDÖvRb33c´Æ&VÅó"Âb33c´fÆS  66Rb33c¶×6rÒb33c´Æ&VÅó0 wV7G&Å6WDÖvRb33c´Æ&VÅó2Âb33c´fÆS £¶WF2âââââFò
Edited by J0ker
Link to comment
Share on other sites

I don't have much expierience with this, but I think you could just put in the numbers of the controls.

IE: Msgbox(0, "", $Label_1 & " " & $Label_99) to figure out the values of the controls and then Case $msg = 1 to 99, or do

Case $msg = $Label_1 to $Label_99 and then use $msg wherever you would normally use the $Label that was pressed.

IE

Case $msg = $Label_1 to $Label_99

GuiCtrlDelete($msg)

to delete the label that was pressed... This might only work with the Switch statement, it's been a while since I created a huge gui that needed that.

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

To expand on Kickassjoe's post, I wrote up this quick test script.

#include <GUIConstants.au3>

$gui = GUICreate('', 200, 200)
$bt = GUICtrlCreateButton('Click me', 0, 0, 200, 20)
GUICtrlCreateButton('No, click me', 0, 20, 200, 20)
GUICtrlCreateButton('No, me!', 0, 40, 200, 20)
GUICtrlCreateButton('Screw you, click me!', 0, 60, 200, 20)
$btlast = GUICtrlCreateButton('Crap on that, I''m the best, click me', 0, 80, 200, 20)
GUISetState()

While 1
     $gm = GUIGetMsg()
     Switch $gm
          Case $bt to $btlast
               MsgBox(0,'Clicked', GUICtrlRead($gm))
          Case $GUI_EVENT_CLOSE
               ExitLoop
     EndSwitch
WEnd

I'm sure that demonstrates well enough what you could do.

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...