Jump to content

_Properties Control


Kip
 Share

Recommended Posts

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

:( Atm i search my Scripts and look which could be helpful :)

This is a wrapper for my Icon Selection Script:

http://www.autoit.de/index.php?page=Thread...31304#post31304

CODE
Func _PropertyList_IconChoose($fName="")

Switch StringInStr($fName,"|")

Case 0

Local $file = $fName

Case Else

Local $file = StringLeft($fName,StringInStr($fName,"|")-1)

EndSwitch

Local $return = _ChooseIcon($file)

If $return[0] = "" Then Return $fName

If StringRight($return,4) = ".ico" Then $return[1] = 0

Return $return[0] & "|" & $return[1]

EndFunc

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

Added another 4 functions:

_PropList_EditStart()

_PropList_EditEnd()

_PropList_EditGetValue()

_PropList_EditSetValue()

And modified/simplified ProgAndy's function. (not included yet, there are some bugs :) )

You can set the width manually, or you can set it to 0 (the width of the value field will be used)

Add to example:

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_SHOW



DEFAULT|@SW_SHOWMAXIMIZED|@SW_SHOWMINIMIZED|@SW_SHOWMINNOACTIVE|@SW_SHOWNA|@SW_SHOWNOACTIVATE|@SW_SH



OWNORMAL"
$Text = _PropList_ItemGetValue($PropertiesList, $ItemID)

_PropList_EditStart($PropertiesControl, $PropertiesList, $ItemID)

$SelectedText = _PropList_CreateSelectionList($PropertiesControl, $PropertiesList, $ItemID, $ListItems, $Text,120)

_PropList_EditSetValue($SelectedText)

Do
until not _IsPressed("01",$User32)

EndIf

EndIf

Function:

CODE
Func _PropList_CreateSelectionList($PropControl, $Proplist, $ItemID, $ListItems, $ListDefault, $PreferHeight=60, $PreferWidth=0)

$Pos = _PropList_ItemGetValuePos($Proplist,$ItemID)

$win = WinGetPos($PropControl[6])

$hWnd = $PropControl[6]

$iWidth = _WinAPI_GetClientWidth($hWnd)

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

$iHeight = _WinAPI_GetClientHeight($hWnd)

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

$X = $Pos[0]

$Y = $Pos[1]

$Width = $Pos[2]

$Height = $Pos[3]

If not $PreferWidth Then

$Style = _PropList_ItemGetStyle($Proplist, $ItemID)

If BitAND($Style, $PL_BROWSEBUTTON) Then

$Width += 19

EndIf

EndIf

$GUI = GUICreate("",$Width, $PreferHeight, $win[0]+$x+$iBorder,$win[1]+$y+$iTitle+$Height, $WS_POPUP,$WS_EX_TOPMOST, $hWnd)

$listv = GUICtrlCreateList("",0,0,$Width,$PreferHeight)

GUICtrlSetData(-1,$ListItems,$ListDefault)

GUISetState()

While 1

$cInfo = GUIGetCursorInfo($GUI)

If not @error Then

If $cInfo[2] Then

If $cInfo[0] >= 0 and $cInfo[1] >= 0 and $cInfo[0] <= $Width And $cInfo[1] <= $PreferHeight Then ; If clicked inside the window

$Read = GUICtrlRead($listv)

If Not $Read Then $Read = $ListDefault

ExitLoop

Else ; Outside the window

$Read = GUICtrlRead($listv)

If Not $Read Then $Read = $ListDefault

ExitLoop

EndIf

Else

If _IsPressed("0D",$User32) Then

$Read = GUICtrlRead($listv)

If Not $Read Then $Read = $ListDefault

ExitLoop

EndIf

EndIf

Else

$Read = GUICtrlRead($listv)

If Not $Read Then $Read = $ListDefault

ExitLoop

EndIf

WEnd

GUIDelete($GUI)

Return $Read

EndFunc

$Image_State should have the $PL_BROWSEBUTTON style

Edited by Kip
Link to comment
Share on other sites

Theres still a bug. If you press Escape, The Script breaks with an Error.

An easier way, where I found no bugs would be:

CODE
Func _PropList_CreateSelectionList($PropControl, $Proplist, $ItemID, $ListItems, $ListDefault, $PreferHeight=60, $PreferWidth=0)

Local $Read=$ListDefault, $pos, $Style, $win, $hWnd,$y,$Width,$Height,$SelectionGui,$listv,$cInfo,$nMsg

$Pos = _PropList_ItemGetValuePos($Proplist,$ItemID)

Local $Style = _PropList_ItemGetStyle($Proplist, $ItemID)

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

Local $win = WinGetPos(GUICtrlGetHandle($Proplist[$ItemID][0]))

Else

Local $win = WinGetPos(GUICtrlGetHandle($Proplist[$ItemID][1]))

EndIf

$hWnd = $PropControl[6]

$Y = $Pos[3]

$Width = $Pos[2]

$Height = $Pos[3]

If not $PreferWidth Then

If BitAND($Style, $PL_BROWSEBUTTON) Then

$Width += 19

EndIf

Else

$Width = $PreferWidth

EndIf

Local $SelectionGui = GUICreate("",$Width, $PreferHeight, $win[0],$win[1]+$y, $WS_POPUP,$WS_EX_TOOLWINDOW, $hWnd)

Local $listv = GUICtrlCreateList("",0,0,$Width,$PreferHeight)

GUICtrlSetData(-1,$ListItems,$ListDefault)

GUISetState(@SW_SHOW,$SelectionGui)

Local $cInfo ,$nMsg

While WinActive($SelectionGui)

$cInfo = GUIGetCursorInfo($SelectionGui)

$nMsg = GUIGetMsg(1)

Select

Case $cInfo[2]

While $cInfo[2]

$nMsg = GUIGetMsg(1)

If $nMsg[0] = $listv And $cInfo[2] And $nMsg[1] = $SelectionGui Then

$Read = GUICtrlRead($listv)

ExitLoop 2

EndIf

$cInfo = GUIGetCursorInfo($SelectionGui)

Sleep(100)

WEnd

Case _IsPressed("0D",$User32)

$Read = GUICtrlRead($listv)

If Not $Read Then $Read = $ListDefault

ExitLoop

Case $nMsg[0] = $GUI_EVENT_CLOSE

ExitLoop

Case $nMsg[1] > 0 And $nMsg[1] <> $SelectionGui

ExitLoop

EndSelect

WEnd

GUIDelete($SelectionGui)

Return $Read

EndFunc

Here are no GUIRegisterMsg needed :) and I found a way to Replace the _WIN_GetTitlebarheight etc. Simply use WinGetPos with the ControlHanlde, and you get it's screen-Coords. 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

OK, So just add this, make a global Variable, that is the Same for All PopUps and then all is fine :)

//Edit: No, use

GUIRegisterMsg(0x0216,"Moving")

...

Func Moving($hWnd, $Msg, $wParam, $lParam)

GUISetState(@SW_HIDE,$SelectionGui)

EndFunc

otherwise, the Results of the Funcs are Sometimes Not Correct.

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

Added:

_PropList_Dropdown_Check()

_PropList_Dropdown_Style()

_PropList_ListState()

Renamed:

_PropList_SelectionList() to _PropList_Dropdown_List()

_PropList_CreateList() to _PropList_ListCreate()

_PropList_UpdateList() to _PropList_ListUpdate()

Impressive! I can't wait to see this in its full beauty :)

I don't think I can get any more beauty out of it :) :)

Link to comment
Share on other sites

You should add a parameter for FontWeight to you SetFont Funcs, like:

Func _PropList_ItemSetNameFont($Proplist, $ItemID, $font = "MS Sans Serif", $Size = 8.5, $Attribute = 0, $Weight = 400)
    Return GUICtrlSetFont($Proplist[$ItemID][3], $Size, $Weight, $Attribute, $font)
EndFunc  ;==>_PropList_ItemSetNameFont

*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

  • 1 month later...

This is for your visual autoit project isn't it?

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Did you notice this thread was over a month old? muttley

Not really :/ my bad lol.

There i go reviving an old post i knew this would happen some day.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

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