관리 메뉴

ㄴrㅎnㅂrㄹrㄱi

[라이브러리] PGui 본문

AUTOHOTKEY/스크립트

[라이브러리] PGui

님투 2009. 1. 12. 09:41
반응형

[module] Properties 0.2

This is general editor viewer for settings/properties in the form of includable module, that can be controled via exposed API. 



Current API 

Code (Copy):
Properties_Add( pProperty, pNo=-1 )
Properties_AddFromFile( file ) 
Properties_AddFromText( text ) 
Properties_Create(pHandler, title="", flags="", GuiNum=89) 
Properties_Clear()
Properties_GetValue( pName ) 
Properties_Hide()
Properties_SetColors(colors)
Properties_SetFont(element, font) 
Properties_Show(x="", y="",w="", h="")


Documentation 
In the source. Functions starting with small letters are internal. Those starting with upper case form exposed API. 

Code (Expand - Copy):

; Title:        Properties GUI
;                Settings/Properties editor/viewer.
;
; Version:  0.1


;------------------------------------------------------------------------------------------
; Function:     Clear
;               Clear Property window
;
;-----------------------------------------------------------------------------------------
; Function:     GetValue
;               Get property value
;
; Parameters:
;               pName       - Proeprty name for which to get value
;
; Returns:
;               Value
;------------------------------------------------------------------------------------------
; Function:     Add
;               Add property to the list on given postion
;
; Parameters:
;               pProperty   - Property defintion - multiline string containing 1 property attribute
;                             per line. 
;               pNo         - Property position. -1 (default) means property will be appended
;
; Atributes:
;               Name        - Name of the property to be displayed in first column
;               Type        - Type of the property. Currently supported types are:
;                             Text, Button Text, CheckBox, ComboBox, Integer, Hyperlink, Separator, WideButton
;               Text        - Default text. For ComboBox item this contains pipe delimited list of 
;                             items to be added to the ComboBox. For CheckBox 1 or 0
;
;------------------------------------------------------------------------------------------
; Function:     AddFromFile
;               Add properties from file
;
; Parameters:
;               pFile   - File from which to import properties. The file contains N property definitions
;                         started by "[Property]" keyword. 
;
;------------------------------------------------------------------------------------------
; Function:     Hide
;               Hide property window. Sets Properties_visible to false
;
;
;------------------------------------------------------------------------------------------
; Function:     Show
;               Show property window. Sets Properties_visible to true
;
; Parameters:
;               x, y, w, h  - Optional parameters for position and size
;
;------------------------------------------------------------------------------------------
; Function:     Create
;               Creates property window.
;
; Parameters:
;               pHandler    - Notification handler. PTY_NAME & PTY_EVENT global variables contain event details
;               title       - GUI title
;               flags       - Space separated creation flags
;               GuiNum      - Optional GUI num, By default 89
;    
; Flags:      
;            ToolWindow   - Makes PGUI tool like.
;            Resize      - Makse PGUI resizable
;            NoCaption   - Removes PGUI caption
;            NoCombo      - Don't create ComboBox
;            H[num]      - Row Height
;
; Notifications:
;               PTY_NAME    - Name of the property that generated event
;               PTY_EVENT   - Can be one of the following: BeforeUpdate, AfterUpdate, Button, Hyperlink
;
; Notes:        
;               Properties_hCombo contains handle to the combo box
;
;------------------------------------------------------------------------------------------
; Function:     SetColors
;               Set colors for any subset of property elements
;
; Parameters:
;               colors  - String containing space separated colors for property elements
;
; Colors:       
;               PB PF - property bg & fg 
;               VB VF - value bg & fg
;               SB SF - separator bg & fg
; Example:
;>              Properties_SetColors("pbAAEEAA sbBFFFFF")  ;set property and separator background color  
;
;------------------------------------------------------------------------------------------
; Function:     SetFont
;               Set font for 1 Propety element
;
; Parameters:
;               element - 1 of the 3 available elements: Property, Value, Separator
;               font    - Font description in AHK format
;




Example 
Code (Expand - Copy):
#NoEnv
#SingleInstance, force
SetBatchLines, -1

    Properties_Create("Handler", "Properties", "ToolWindow Resize")               ;create, set title & flag

   Properties_SetColors("pbAAAAAA pfFFFFFF sbDDDDDD vbDDDDDD")              ;color scheme1
    Properties_SetFont("Separator", "s9 bold italic, Arial")             ;set separator font
    Properties_SetFont("Property", "s9 bold, Arial")             ;set separator font
   
   propText = 
   (LTrim
      [Property]
      Type=Separator
      Text=My Separator

      [Property]
      Name=Button
      Type=Button
      Text=click me

      [Property]
       Name=Text
      Type=Text
      Text=default text

      [Property]
      Type=Separator
      Text=Some longer separator
   
      [Property]
       Name=Combo
      Type=ComboBox
      Text=true|false

      [Property]
       Name=CheckBox
      Type=CheckBox
      Text=1

      [Property]
       Name=HyperLink
      Type=HyperLink
      Text=www.autohotkey.com

      [Property]
      Name=WideButton
      Type=WideButton
      Text=click me

      [Property]
       Name=Integer
      Type=Integer
      Text=134
    )
   
    Properties_AddFromText(propText)
    Properties_Show()                                               ;show with default size and pos

return

F12::
     Properties_Clear()
   Properties_AddFromFile("Text.ini")
   Properties_Show()
return

Handler:
;   OutputDebug % "------------------`nEvent: " PTY_EVENT  "`nName: " PTY_NAME  "`nValue: " Properties_GetValue(PTY_NAME)
   if PTY_EVENT in Button,HyperLink
      msgbox    % PTY_NAME "`n`n" Properties_GetValue(PTY_NAME)
   
return

#Include Properties.ahk



Download


반응형

'AUTOHOTKEY > 스크립트' 카테고리의 다른 글

SendMessage scripts for ListBox  (0) 2010.03.23
Custom GUI Controls & GUI related  (0) 2010.02.22
[라이브러리] MMenu  (0) 2009.01.12
[라이브러리] Dock  (0) 2009.01.12
[라이브러리] Anchor  (0) 2009.01.12
Comments