일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- if(식)
- SetControlDelay
- autohotkey
- SetKeyDelay
- DetectHiddenWindows
- EnvDiv
- SetMouseDelay
- Blocks
- MouseClick
- EnvSet
- ControlSend
- Threads
- SetTitleMatchMode
- if
- 함수
- SetEnv
- EnvSub
- EnvAdd
- 식
- IfInString
- 식의 설명
- StringGetPos
- Var:=식
- EnvMult
- Menu
- IfWinExist
- IF (식)
- API
- ControlGetText
- 배열
- Today
- Total
ㄴrㅎnㅂrㄹrㄱi
GroupBox2() 본문
http://www.autohotkey.com/board/topic/89155-groupbox2/
/* Name: GroupBox2 Version: 1.1 (Mon January 14, 2013) Created: Sun January 13, 2013 Author: tidbit Syntax: GroupBox2(Text, Controls [, GuiName=1, Offset="0,0", Padding="5,5,5,5", TitleHeight=15]) Text: The Text of the title for the group box. Controls: A comma separated list of Associated Variables, Hwnd (ahk v1.1.04+), ClassNN or name/Text of the Controls that will be inside the GroupBox. Order does not matter. GuiName: [Optional] The name or number of the GUI that the Controls are on. Offset: [Optional] Offset the Group Box and all its Controls by x,y pixels from the top-left point. Format: x,y Padding: [Optional] How much pixels do you want between the Controls and the inner edges of the Group Box. Format: left,right,top,bottom TitleHeight: [Optional] The height, in pixels, that the title Text is. Returns: The function returns an array object in this format: [1] UID: The unique associate variable of the Group Box created. [2] x: The x position of the Group Box created. [3] y: The y position of the Group Box created. [4] w: The width of the Group Box created. [5] h: The height of the Group Box created. Usage: GroupBox2("", "Btn1,Btn2") GroupBox2("Some Title", "Btn1,Btn2,Btn3,Btn4,Btn5,Btn6,Btn7",1,"10,0") GroupBox2("Email Form", "Name,EMAddress,Text,Submit", "EmailPopup", 12,,"8,5,8,3") */ GroupBox2(Text, Controls, GuiName=1, Offset="0,0", Padding="3,3,3,3", TitleHeight=15) { static ; set the main variables to 0. Probably not needed but makes me feel safe having it. <3 xx:=yy:=ww:=hh:=PosX:=PosY:=PosW:=PosH:=0 ; split the padding and offset values into arrays StringSplit, Padding, Padding, `, StringSplit, Offset, Offset, `, ; this is where the magic begins. ; on the first pass, we set a the x/y/w/h to the info of the first control in the list. ; and then we do some fancy if/else stuff (in the form of a ternary ((if) ? then : else)) ... ; ... to determine if the top-left coords are lower then the last analyzed control ... ; ... and if the bottom-right coords are higher then the last analyzed control. ; finally we shift the controls inside the group box by the padding and other settings. loop, parse, Controls, `, { GuiControlGet, Pos, Pos, %A_LoopField% if (a_index=1) { xx:=PosX yy:=PosY ww:=PosX+PosW hh:=PosY+PosH } xx:=((xx<PosX) ? xx : PosX) yy:=((yy<PosY) ? yy : PosY) ww:=((ww>PosX+PosW) ? ww : PosX+PosW) hh:=((hh>PosY+PosH) ? hh : PosY+PosH) GuiControl, Move, %A_LoopField%, % "x" PosX+Padding1+Offset1 " y" PosY+Padding3+Offset2+titleHeight } ; shift the group box over xx+=Offset1 yy+=Offset2 ; adjust the width/height to add padding on top right and bottom. ww+=Padding1+Padding2+Offset1-xx hh+=Padding3+Padding4+titleHeight+Offset2-yy ; create a unique variable name for the group box that is about to be created. counter+=1 UID:="GB" GUIName counter xx yy ww hh ; add the stupid little box. Gui, %GuiName%: add, GroupBox, x%xx% y%yy% w%ww% h%hh% v%UID%, %Text% ; all done :D Return [uid,xx,yy,ww,hh]}
샘플 #1
/* Name: Interactive Listview Template Version 1.0 (Mon January 14, 2013) Created: Mon January 14, 2013 Author: tidbit Credit: About: Simple listview template where you can add, edit and delete items through a simple form. */ #SingleInstance, force Gui, margin, 6, 6 Gui, add, edit, x6 y6 w100 vData1, apple Gui, add, edit, x+5 yp w100 vData2, red Gui, add, button, x6 y+10 w100 vBtn1 Default gsubmit, Submit Gui, add, button, x+5 yp w100 vBtn2 gdelete, Delete selected Groupbox2("Add/Remove", "data1,data2,btn1,btn2") Gui, add, edit, x6 y+5 w100 vEdit1 Gui, add, edit, x+5 yp w100 vEdit2 Gui, add, button, xp y+5 w100 vBtn3 gEditRow, Edit Groupbox2("Edit", "edit1,edit2,btn3") Gui, add, listview, ym w300 r10 altsubmit vMyList gListClicked, Item|Color Gui, show,,Interactive Listview Template Return Submit: Gui, submit, NoHide LV_Add("", data1, data2) LV_ModifyCol() GuiControl, focus, data1 Return delete: row:=LV_GetNext() LV_Delete(row) Return ListClicked: rowToEdit:=LV_GetNext() LV_GetText(item1, rowToEdit, 1) LV_GetText(item2, rowToEdit, 2) GuiControl,,edit1, %item1% GuiControl,,edit2, %item2% Return EditRow: Gui, Submit, NoHide LV_Modify(rowToEdit, "", edit1, edit2) LV_ModifyCol() Return GuiClose: Esc:: Exitapp Return
샘플 #2
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, force
Gui, add, radio, x9 y6 r1 vBtn1, button1
Gui, add, button, x9 y+30 w210 h30 vBtn2, button2
GB1:=GroupBox2("2222222", "Btn1",,"20,0")
GB2:=GroupBox2("3333333", "Btn2",,,"5,20,20,5")
Gui, add, checkbox, x3 y+4 w130 r3 vBtn3, button3
GB3:=GroupBox2("1111111", GB1[1] "," GB2[1] ",Btn1,Btn2,Btn3")
Gui, add, checkbox, x5 y+6 w170 r1 vBtn4, button4
Gui, add, listview, x+4 yp w120 r6 vBtn5, button5|gg|gg
Gui, add, button, x+4 yp w70 r1 vBtn6, button6
Gui, add, edit, x5 y+6 w150 r1 vBtn7, button7
GroupBox2("All", GB1[1] "," GB2[1] "," GB3[1] ",Btn1,Btn2,Btn3,Btn4,Btn5,Btn6,Btn7")
Gui, add, button, x13 y+13 w24 r2, button
Gui, add, button, x+5 yp w170 r1, we are outside
Gui, add, button, x+4 yp w70 r1, button0
gui, Show
ToolTip % pos[5]
Return
'AUTOHOTKEY > 스크립트' 카테고리의 다른 글
브라우저 (0) | 2013.01.17 |
---|---|
ELP Extended-length path library 1.1 (0) | 2013.01.15 |
돋보기 기능 만들기 (0) | 2011.05.12 |
SendMessage scripts for ListBox (0) | 2010.03.23 |
Custom GUI Controls & GUI related (0) | 2010.02.22 |