Kip Posted May 16, 2008 Share Posted May 16, 2008 (edited) 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.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 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 $SelectionGuiGlobal 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_LASTGlobal $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 = $PropertiesListNLGUISetState()$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 = $PropertiesListNLCase 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 fieldSwitch $ItemIDCase $Item_Left, $Item_Top, $Item_Width, $Item_Height, $Item_Cursor, $Item_LimitGUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL+$ES_NUMBER)Case ElseGUICtrlSetStyle($EditControl,$ES_AUTOHSCROLL)EndSwitchElseIf $UpdateMsg = $PL_MSG_EDITEND Then ; If you stopped editing a field$Text = _PropList_ItemGetValue($PropertiesList, $ItemID) ; Get the new enteredSwitch $ItemIDCase $Item_TextGUICtrlSetData($DummyButton,$Text)Case $Item_WidthGUICtrlSetPos($DummyButton,8,8,$Text)Case $Item_HeightGUICtrlSetPos($DummyButton,8,8,-1,$Text)Case $Item_CursorGUICtrlSetCursor($DummyButton,$Text)Case $Item_TooltipGUICtrlSetTip($DummyButton,$Text)EndSwitchElseIf $UpdateMsg = $PL_MSG_BROWSEBUTTON Then ; If that small little button is pressedIf $ItemID = $Item_State Then$ListItems = "@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_SHOWNOACTIVATE|@SW_SHOWNORMAL"$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)EndIfEndIfSleep(20)EndSwitchWEndwith some Small help from ludocusEdit: I probably should upload the script Edit2: 700th post _PropertiesList.au3 Edited September 19, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ludocus Posted May 16, 2008 Share Posted May 16, 2008 Looks good, I helped you though Link to comment Share on other sites More sharing options...
Kip Posted May 16, 2008 Author Share Posted May 16, 2008 with 3 little lines MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ludocus Posted May 16, 2008 Share Posted May 16, 2008 HUGE lines and with _ProplistRead I see you don't have that on here Link to comment Share on other sites More sharing options...
Kip Posted May 16, 2008 Author Share Posted May 16, 2008 that became _PropList_ItemGetValue(), I added your name to my first post MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ludocus Posted May 16, 2008 Share Posted May 16, 2008 (edited) Sweet #edit: dude, Kip you gotta have a look at this rediculous post: http://www.autoitscript.com/forum/index.php?showtopic=71415 Edited May 17, 2008 by ludocus Link to comment Share on other sites More sharing options...
gseller Posted May 16, 2008 Share Posted May 16, 2008 Psssst.. Your missing some includes... Link to comment Share on other sites More sharing options...
Kip Posted May 16, 2008 Author Share Posted May 16, 2008 (edited) 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 May 16, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kip Posted May 16, 2008 Author Share Posted May 16, 2008 (edited) added: _PropList_ListSetColor() _PropList_ListSetFont() _PropList_ItemSetValueColor() _PropList_ItemSetValueFont() _PropList_ItemSetNameColor() _PropList_ItemSetNameFont() Edited May 16, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
gseller Posted May 16, 2008 Share Posted May 16, 2008 No Biggie, I have been keeping up with the betas this time and now I have the latest.. Yeah! No broken script this time. LOL Link to comment Share on other sites More sharing options...
Kip Posted May 17, 2008 Author Share Posted May 17, 2008 (edited) But do you like it? Edited May 17, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 17, 2008 Share Posted May 17, 2008 Its great! I added a few things to your example, like Color And Font Chooser and Scroolbars expandcollapse popup#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 More sharing options...
Kip Posted May 17, 2008 Author Share Posted May 17, 2008 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? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
i542 Posted May 17, 2008 Share Posted May 17, 2008 Sweet #edit: dude, Kip you gotta have a look at this rediciales (Don't know how to spell that) post: http://www.autoitscript.com/forum/index.php?showtopic=71415Ridiculous. You spell it ridiculous.@ProgAndy: next time please use Codebox tags@Kip: N-ice! I can do signature me. Link to comment Share on other sites More sharing options...
Kip Posted May 17, 2008 Author Share Posted May 17, 2008 ... at this rediciales (Don't know how to spell that)shame on you MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ludocus Posted May 17, 2008 Share Posted May 17, 2008 lol, ga me nou niet vertellen dat jij het beter kan? Link to comment Share on other sites More sharing options...
ProgAndy Posted May 17, 2008 Share Posted May 17, 2008 I have another Function, which could help: A "Combo"-List CODEFunc _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 More sharing options...
ludocus Posted May 17, 2008 Share Posted May 17, 2008 (edited) Kip, Daar zocht je net naar toch? Edited May 17, 2008 by ludocus Link to comment Share on other sites More sharing options...
Kip Posted May 17, 2008 Author Share Posted May 17, 2008 I have another Function, which could help: A "Combo"-ListI get this: ERROR: _PropList_ItemGetPos(): undefined function. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 17, 2008 Share Posted May 17, 2008 (edited) I forgot this: CODEFunc _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 May 17, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now