Jump to content

_Properties Control


Kip
 Share

Recommended Posts

Hey,

Because I needed a properties control for an other project of mine, and couldn't find a good solution, I created one myself. :(

My properties control, is like a listview, but can be edited in place and buttons can be added to an item.

Posted Image

Functions:

_PropList_Create()

_PropList_AddItem()

_PropList_ItemGetStyle()

_PropList_ItemGetName()

_PropList_ItemSetName()

_PropList_ItemGetValue()

_PropList_ItemSetValue()

_PropList_ListSetState()

_PropList_ItemSetState()

_PropList_ListCreate()

_PropList_ListUpdate()

_PropList_ListState()

_PropList_ListSetNameColor()

_PropList_ListSetNameFont()

_PropList_ListSetValueColor()

_PropList_ListSetValueFont()

_PropList_ItemSetValueColor()

_PropList_ItemSetValueFont()

_PropList_ItemSetNameColor()

_PropList_ItemSetNameFont()

_PropList_EditStart()

_PropList_EditEnd()

_PropList_EditGetValue()

_PropList_EditSetValue()

_PropList_Dropdown_List()

_PropList_Dropdown_Check()

_PropList_Dropdown_Style()

btw: it are just a bunch of labels with some buttons :D

Please leave some comments.

example:

CODE
#include <GUIConstants.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

#include <Array.au3>

#include "_PropertiesList.au3"

Global $ChecklistItems[1]

$Gui = GUICreate("PropList Example", 400, 300)

$EditControl = GUICtrlCreateInput("",0,0,10,10) ; You don't have to create your own control, but this way you can manage the styles, states, colors, etc.

$English = GUICtrlCreateButton("English",10,10,80,20)

$Dutch = GUICtrlCreateButton("Dutch",10,35,80,20)

$PropertiesControl = _PropList_Create($Gui, 100, 10, 170, 180, $EditControl)

Global $Checklist[10]

$Checklist[0] = "0|item1" ; 0 = not checked

$Checklist[1] = "1|item2" ; 1 = checked

$Checklist[2] = "1|item3"

$Checklist[3] = "0|item4"

$Checklist[4] = "1|item5"

$Checklist[5] = "1|item6"

$Checklist[6] = "1|item7"

$Checklist[7] = "1|item8"

$Checklist[8] = "1|item9"

$Checklist[9] = "1|item10"

Global $SelectionGui

Global Enum $Item_Text, $Item_Left, $Item_Top, $Item_Width, $Item_Height, $Item_Style, $Item_ExStyle, $Item_Image, $Item_State, $Item_Color, $Item_BkColor, $Item_Cursor, $Item_Font, $Item_Limit, $Item_Tooltip, $Item_LAST

Global $Items[$Item_LAST]

$Items[$Item_Text] = _PropList_AddItem($PropertiesControl,"Text","Button1", $PL_INPUT) ; Input (can be changed)

$Items[$Item_Left] = _PropList_AddItem($PropertiesControl,"Left","8", $PL_LABEL) ; Label (can NOT be changed)

$Items[$Item_Top] = _PropList_AddItem($PropertiesControl,"Top","8", $PL_LABEL)

$Items[$Item_Width] = _PropList_AddItem($PropertiesControl,"Width","80", $PL_INPUT)

$Items[$Item_Height] = _PropList_AddItem($PropertiesControl,"Height","23", $PL_INPUT)

$Items[$Item_Style] = _PropList_AddItem($PropertiesControl,"Style","", $PL_INPUT+$PL_BROWSEBUTTON) ; BrowseButton (a small button is added after the value field)

$Items[$Item_ExStyle] = _PropList_AddItem($PropertiesControl,"ExStyle","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Image] = _PropList_AddItem($PropertiesControl,"Image","\...", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_State] = _PropList_AddItem($PropertiesControl,"State","@SW_SHOW", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Color] = _PropList_AddItem($PropertiesControl,"Color","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_BkColor] = _PropList_AddItem($PropertiesControl,"BkColor","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Cursor] = _PropList_AddItem($PropertiesControl,"Cursor","2", $PL_INPUT)

$Items[$Item_Font] = _PropList_AddItem($PropertiesControl,"Font","Microsoft Sans Serif: 8: Normal", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Limit] = _PropList_AddItem($PropertiesControl,"Limit","", $PL_INPUT)

$Items[$Item_Tooltip] = _PropList_AddItem($PropertiesControl,"Tooltip","Click here!", $PL_INPUT)

$PropertiesListEN = _PropList_ListCreate($PropertiesControl, $Items, 16, 60)

_PropList_ListState($PropertiesListEN, $GUI_HIDE)

$Items[$Item_Text] = _PropList_AddItem($PropertiesControl,"Naam","Knop1", $PL_INPUT) ; Input (can be changed)

$Items[$Item_Left] = _PropList_AddItem($PropertiesControl,"Links","8", $PL_LABEL) ; Label (can NOT be changed)

$Items[$Item_Top] = _PropList_AddItem($PropertiesControl,"Boven","8", $PL_LABEL)

$Items[$Item_Width] = _PropList_AddItem($PropertiesControl,"Breedte","80", $PL_INPUT)

$Items[$Item_Height] = _PropList_AddItem($PropertiesControl,"Hoogte","23", $PL_INPUT)

$Items[$Item_Style] = _PropList_AddItem($PropertiesControl,"Stijl","", $PL_INPUT+$PL_BROWSEBUTTON) ; BrowseButton (a small button is added after the value field)

$Items[$Item_ExStyle] = _PropList_AddItem($PropertiesControl,"ExStijl","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Image] = _PropList_AddItem($PropertiesControl,"Afbeelding","\...", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_State] = _PropList_AddItem($PropertiesControl,"Staat","@SW_SHOW", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Color] = _PropList_AddItem($PropertiesControl,"Kleur","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_BkColor] = _PropList_AddItem($PropertiesControl,"AchKleur","", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Cursor] = _PropList_AddItem($PropertiesControl,"Muis","2", $PL_INPUT)

$Items[$Item_Font] = _PropList_AddItem($PropertiesControl,"Lettertype","Microsoft Sans Serif: 8: Normal", $PL_INPUT+$PL_BROWSEBUTTON)

$Items[$Item_Limit] = _PropList_AddItem($PropertiesControl,"Limiet","", $PL_INPUT)

$Items[$Item_Tooltip] = _PropList_AddItem($PropertiesControl,"Hint","Klik hier!", $PL_INPUT)

$PropertiesListNL = _PropList_ListCreate($PropertiesControl, $Items, 16, 60)

$PropertiesList = $PropertiesListNL

GUISetState()

$ButtonGui = GUICreate("Button Gui",120,100,10,10,-1,-1,$Gui)

$DummyButton = GUICtrlCreateButton("Button1",8,8,80,23)

GUISetState()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $English

_PropList_ListState($PropertiesListEN, $GUI_SHOW)

_PropList_ListState($PropertiesListNL, $GUI_HIDE)

$PropertiesList = $PropertiesListEN

Case $Dutch

_PropList_ListState($PropertiesListNL, $GUI_SHOW)

_PropList_ListState($PropertiesListEN, $GUI_HIDE)

$PropertiesList = $PropertiesListNL

Case Else

$Update = _PropList_ListUpdate($PropertiesControl, $PropertiesList, $nMsg) ; If you don't pass $nMsg to the function, the funtion will do a guigetmsg() automaticly (which could slow down the script)

$ItemID = $Update[0]

$UpdateMsg = $Update[1]

If $UpdateMsg = $PL_MSG_EDITSTART Then ; If you start editing a field

Switch $ItemID

Case $Item_Left, $Item_Top, $Item_Width, $Item_Height, $Item_Cursor, $Item_Limit

GUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL+$ES_NUMBER)

Case Else

GUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL)

EndSwitch

ElseIf $UpdateMsg = $PL_MSG_EDITEND Then ; If you stopped editing a field

$Text = _PropList_ItemGetValue($PropertiesList, $ItemID) ; Get the new entered

Switch $ItemID

Case $Item_Text

GUICtrlSetData($DummyButton,$Text)

Case $Item_Width

GUICtrlSetPos($DummyButton,8,8,$Text)

Case $Item_Height

GUICtrlSetPos($DummyButton,8,8,-1,$Text)

Case $Item_Cursor

GUICtrlSetCursor($DummyButton,$Text)

Case $Item_Tooltip

GUICtrlSetTip($DummyButton,$Text)

EndSwitch

ElseIf $UpdateMsg = $PL_MSG_BROWSEBUTTON Then ; If that small little button is pressed

If $ItemID = $Item_State Then

$ListItems = "@SW_DISABLE|@SW_ENABLE|@SW_HIDE|@SW_LOCK|@SW_MAXIMIZE|@SW_MINIMIZE|@SW_RESTORE|@SW_SHOW|@SW_SHO

WDEFAULT|@SW_SHOWMAXIMIZED|@SW_SHOWMINIMIZED|@SW_SHOWMINNOACTIVE|@SW_SHOWNA|@SW_SHOWNOACTIVATE|@SW_S

HOWNORMAL"

$Text = _PropList_ItemGetValue($PropertiesList, $ItemID)

$SelectedText = _PropList_Dropdown_List($PropertiesControl, $PropertiesList, $ItemID, $ListItems, $Text,5+13*8)

_PropList_ItemSetValue($PropertiesList, $ItemID, $SelectedText)

ElseIf $ItemID = $Item_Style Then

$Checklist = _PropList_Dropdown_Check($PropertiesControl, $PropertiesList, $ItemID, $Checklist, 0, 5+16*8)

EndIf

EndIf

Sleep(20)

EndSwitch

WEnd

with some Small help from ludocus

Edit: I probably should upload the script :)

Edit2: 700th post :D

_PropertiesList.au3

Edited by Kip
Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

no, i'm just using 3.2.12.0, you probably not :)

But also yes, if you are using this you should include GUIConstantsEx.au3 and WindowsConstants.au3 in your own script. (3.2.12.0)

It seems logical to me that you always include those when you are having GUIs in your script

Edited by Kip
Link to comment
Share on other sites

Its great! I added a few things to your example, like Color And Font Chooser and Scroolbars :)

#include "_PropertiesList.au3"
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIScrollbars.au3>
#include <ScrollBarConstants.au3>

$Gui = GUICreate("PropList Example", 180, 200,-1,-1,-1,$WS_EX_TOOLWINDOW)
_GUIScrollBars_EnableScrollBar($GUI,$SB_VERT)

$EditControl = GUICtrlCreateInput("",0,0,10,10) ; You don't have to create your own control, but this way you can manage the styles, states, colors, etc.

$PropertiesControl = _PropList_Create($Gui, 0, 0, 170, 180, $EditControl)

Global Enum $Item_Text, $Item_Left, $Item_Top, $Item_Width, $Item_Height, $Item_Style, $Item_ExStyle, $Item_Image, $Item_State, $Item_Color, $Item_BkColor, $Item_Cursor, $Item_Font, $Item_Limit, $Item_Tooltip, $Item_LAST

Global $Items[$Item_LAST]

$Items[$Item_Text] = _PropList_AddItem($PropertiesControl,"Text","Button1", $PL_INPUT) ; Input (can be changed)
$Items[$Item_Left] = _PropList_AddItem($PropertiesControl,"Left","8", $PL_LABEL) ; Label (can NOT be changed)
$Items[$Item_Top] = _PropList_AddItem($PropertiesControl,"Top","8", $PL_LABEL)
$Items[$Item_Width] = _PropList_AddItem($PropertiesControl,"Width","80", $PL_INPUT)
$Items[$Item_Height] = _PropList_AddItem($PropertiesControl,"Height","23", $PL_INPUT)
$Items[$Item_Style] = _PropList_AddItem($PropertiesControl,"Style","", $PL_INPUT+$PL_BROWSEBUTTON) ; BrowseButton (a small button is added after the value field)
$Items[$Item_ExStyle] = _PropList_AddItem($PropertiesControl,"ExStyle","", $PL_INPUT+$PL_BROWSEBUTTON)
$Items[$Item_Image] = _PropList_AddItem($PropertiesControl,"Image","\...", $PL_INPUT+$PL_BROWSEBUTTON)
$Items[$Item_State] = _PropList_AddItem($PropertiesControl,"State","$GUI_SHOW", $PL_INPUT)
$Items[$Item_Color] = _PropList_AddItem($PropertiesControl,"Color","0xFF0000", $PL_INPUT+$PL_BROWSEBUTTON)
$Items[$Item_BkColor] = _PropList_AddItem($PropertiesControl,"BkColor","", $PL_INPUT+$PL_BROWSEBUTTON)
$Items[$Item_Cursor] = _PropList_AddItem($PropertiesControl,"Cursor","2", $PL_INPUT)
$Items[$Item_Font] = _PropList_AddItem($PropertiesControl,"Font","Microsoft Sans Serif | 11 | 700 | 0x800000 | 0", $PL_INPUT+$PL_BROWSEBUTTON)
$Items[$Item_Limit] = _PropList_AddItem($PropertiesControl,"Limit","", $PL_INPUT)
$Items[$Item_Tooltip] = _PropList_AddItem($PropertiesControl,"Tooltip","Click here!", $PL_INPUT)

$PropertiesList = _PropList_CreateList($PropertiesControl, $Items, 16, 0, "Property", "Value")
_GUIScrollBars_Init($GUI)
_GUIScrollBars_ShowScrollBar($GUI,$SB_HORZ,False)
_GUIScrollBars_SetScrollRange($GUI,$SB_VERT,0,$Item_LAST-1)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")


GUISetState()

$ButtonGui = GUICreate("Button Gui",120,100,10,10,-1,-1,$Gui)
$DummyButton = GUICtrlCreateButton("Button1",8,8,80,23)
GUISetState()


While 1

$nMsg = GUIGetMsg()

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case Else
$Update = _PropList_UpdateList($PropertiesControl, $PropertiesList, $nMsg) ; If you don't pass $nMsg to the function, the funtion will do a guigetmsg() automaticly (which could slow down the script)
$ItemID = $Update[0]
$UpdateMsg = $Update[1]

If $UpdateMsg = $PL_MSG_EDITSTART Then ; If you start editing a field

Switch $ItemID
Case $Item_Left, $Item_Top, $Item_Width, $Item_Height, $Item_Cursor, $Item_Limit
GUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL+$ES_NUMBER)
Case Else
GUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL)
EndSwitch

ElseIf $UpdateMsg = $PL_MSG_EDITEND Then ; If you stopped editing a field

$Text = _PropList_ItemGetValue($PropertiesList, $ItemID) ; Get the new entered

Switch $ItemID
Case $Item_Text
GUICtrlSetData($DummyButton,$Text)

Case $Item_Width
GUICtrlSetPos($DummyButton,8,8,$Text)

Case $Item_Height
GUICtrlSetPos($DummyButton,8,8,-1,$Text)

Case $Item_Cursor
GUICtrlSetCursor($DummyButton,$Text)

Case $Item_Tooltip
GUICtrlSetTip($DummyButton,$Text)

EndSwitch

ElseIf $UpdateMsg = $PL_MSG_BROWSEBUTTON Then ; If that small little button is pressed
Switch $ItemID
    Case $Item_Image
        _PropList_ItemSetValue($PropertiesList, $ItemID, FileOpenDialog("Choose file",@MyDocumentsDir,"All files (*.*)"))
    Case $Item_Font
        _PropList_ItemSetValue($PropertiesList, $ItemID, _PropList_FontChoose(_PropList_ItemGetValue($PropertiesList,$ItemID)))
        _PropList_ItemSetValueColor($PropertiesList,$ItemID,_PropList_ItemGetValue($PropertiesList,$ItemID))
    Case $Item_Color
        _PropList_ItemSetValue($PropertiesList, $ItemID, _PropList_ColorChoose(_PropList_ItemGetValue($PropertiesList,$ItemID)))
        _PropList_ItemSetValueColor($PropertiesList,$ItemID,0x000000,_PropList_ItemGetValue($PropertiesList,$ItemID))
EndSwitch

EndIf

Sleep(20)
EndSwitch

WEnd

; Author: Prog@ndy :P
Func _PropList_ColorChoose($oldCol=0)
    Return _ChooseColor(2,$oldCol,2)
EndFunc

; Author: Prog@ndy
Func _PropList_FontChoose($text="")
    Local $sFontName = "Courier New", $iPointSize = 10, $iColorRef = 0, $iFontWeight = 0, $iItalic = False, $iUnderline = False, $iStrikethru = False, $temp,$i_transcolor
    Local $x = StringSplit($text," | ",1)
    If $x[0] = 5 Then
        $i_transcolor = Hex($x[4],6)
        Local $color = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
        $temp = Assign("sFontName",$x[1])+Assign("iPointSize",$x[2])+Assign("iFontWeight",$x[3])+Assign("iColorRef",$color)+Assign("iItalic",BitAND($x[5],2)=2)+Assign("iUnderline",BitAND($x[5],4)=4)+Assign("iStrikethru",BitAND($x[5],8)=8)
    EndIf
    Local $font = _ChooseFont($sFontName , $iPointSize , $iColorRef , $iFontWeight , $iItalic , $iUnderline , $iStrikethru)
    If $font = -1 Then Return $text
    Return    $font[2] & " | " & $font[3] & " | " & $font[4] & " | " & $font[7] & " | " & $font[1]
EndFunc

; Author: Prog@ndy
Func _PropList_GetBottomYPos($Proplist)
    Local $ItemID = UBound($PropList)-1, $pos
    $Style = _PropList_ItemGetStyle($Proplist, $ItemID)
    
    If BitAND($Style, $PL_INPUT) Or BitAND($Style, $PL_LABEL) Then
        $pos = ControlGetPos(GUICtrlGetHandle($Proplist[$ItemID][0]),"","")
    Else 
        $pos = ControlGetPos(GUICtrlGetHandle($Proplist[$ItemID][1]),"","")
    EndIf
    MsgBox(0, '', $pos[1] & " - "& $pos[3]& " - "&2)
    Return $pos[1]+$pos[3]+2
EndFunc


Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    
    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient
    
    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    
    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch
    
;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_VSCROLL

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Ah thanks, I never know how to do those scrollbars.

I changed:

_PropList_ListSetColor()

_PropList_ListSetFont()

Into:

_PropList_ListSetNameColor()

_PropList_ListSetNameFont()

_PropList_ListSetValueColor()

_PropList_ListSetValueFont()

Btw: does anyone know why the text in a label disappears when I use $SS_WHITEFRAME, $SS_ETCHEDFRAME or $SS_BLACKFRAME?

Link to comment
Share on other sites

I have another Function, which could help: A "Combo"-List :)

CODE
Func _ListSelect($list, $x, $y,$w,$h,$default = "")

Local $win = WinGetPos("")

Local $oldM = Opt("GuiOnEventMode",0)

Local $GUI = GUICreate("",$w,$h,$win[0]+$x+_Win_BorderWidth(WinGetHandle("")),$win[1]+$y+ _Win_TitlebarHeight(WinGetHandle("")),$WS_POPUP,$WS_EX_TOPMOSt)

Local $listv = GUICtrlCreateList("",0,0,$w,$h)

GUICtrlSetData(-1,$list,$default)

Local $Msg

GUISetState()

Local $DLL = DllOpen("user32.dll")

While 1

$Msg = GUIGetMsg(1)

If Not WinActive($GUI) Then

ExitLoop

ElseIf _IsPressed("0D",$DLL) Then

$Msg[1] = $GUI

$Msg[0] = $listv

EndIf

If $Msg[1] = $GUI Then

Switch $Msg[0]

Case $GUI_EVENT_CLOSE

ExitLoop

Case $listv

If _IsPressed(25,$DLL) Or _IsPressed(26,$DLL) Or _IsPressed(27,$DLL) Or _IsPressed(28,$DLL) Then ContinueLoop

$default = GUICtrlRead($listv)

ExitLoop

EndSwitch

EndIf

WEnd

DllClose($DLL)

GUIDelete()

Opt("GuiOnEventMode",$oldM)

Return $default

EndFunc

; Author: Prog@ndy

Func _Win_TitlebarHeight($hWnd)

Local $iHeight = _WinAPI_GetClientHeight($hWnd)

Local $iBorder = _Win_BorderWidth($hWnd)

Local $iTitle = Int(_WinAPI_GetWindowHeight($hWnd)-$iHeight-$iBorder)

Return $iTitle

EndFunc

; Author: Prog@ndy

Func _Win_BorderWidth($hWnd)

Local $iWidth = _WinAPI_GetClientWidth($hWnd)

Local $scroll = _GUIScrollBars_GetScrollBarRect($hWnd,$OBJID_VSCROLL)

If not @error Then $iWidth += ($scroll[2]-$scroll[0])

Local $iBorder = Int((_WinAPI_GetWindowWidth($hWnd)-$iWidth)/2)

Return $iBorder

EndFunc

Usage:

CODE
$Items[$Item_State] = _PropList_AddItem($PropertiesControl,"State","$GUI_SHOW", $PL_INPUT+$PL_BROWSEBUTTON)

...

ElseIf $UpdateMsg = $PL_MSG_BROWSEBUTTON Then ; If that small little button is pressed

Switch $ItemID

Case $Item_State

$pos = _PropList_ItemGetPos($PropertiesList,$ItemID)

$res = _ListSelect( _

"@SW_DISABLE|@SW_ENABLE|@SW_HIDE|@SW_LOCK|@SW_MAXIMIZE|@SW_MINIMIZE|@SW_RESTORE|@SW_SHOW|" & _

"@SW_SHOWDEFAULT|@SW_SHOWMAXIMIZED|@SW_SHOWMINIMIZED|@SW_SHOWMINNOACTIVE|@SW_SHOWNA|@SW_SHOWNOAC

TIVATE|@SW_SHOWNORMAL", _

$pos[0], _

$pos[1], _

200,100,_PropList_ItemGetValue($PropertiesList,$ItemID))

_PropList_ItemSetValue($PropertiesList, $ItemID,$res)

EndSwitch

EndIf

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I forgot this:

CODE
Func _PropList_ItemGetPos($Proplist,$ItemID)

$Style = _PropList_ItemGetStyle($Proplist, $ItemID)

If BitAND($Style, $PL_INPUT) Or BitAND($Style, $PL_LABEL) Then

Return ControlGetPos(GUICtrlGetHandle($Proplist[$ItemID][0]),"","")

Else

Return ControlGetPos(GUICtrlGetHandle($Proplist[$ItemID][1]),"","")

EndIf

EndFunc

And in

Local $GUI = GUICreate("",$w,$h,$win[0]+$x+_Win_BorderWidth(WinGetHandle("")),$win[1]+$y+ _Win_TitlebarHeight(WinGetHandle("") ......

you should add $WS_EX_TOOLWINDOW

and possibly you need to include Winapi.au3

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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