1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Kleiner

Beiträge von Kleiner

  • ArrayUnique ohne Bug´s und Schneller

    • Kleiner
    • 11. November 2010 um 12:54

    Hi!


    Ich Idi.... daran habe ich noch gedacht mist, egal dann halt noch davor!

    Danke dir!

    Lg Kleiner

  • ArrayUnique ohne Bug´s und Schneller

    • Kleiner
    • 11. November 2010 um 12:09

    Hi!

    @Großvater
    Stimmt , alt so viel hättes du nicht machen brauchen, Eine Variable zu abfrage reicht - $vDelim ich habe noch $iFlag für die Entscheidung ob o. Ohne Counter.
    Ich frage mich $iBase zu nehmen, denn meines erachtens nach ist $iBase für den Startindex und nicht für die Entscheidung Counter oder nicht ?Fraglich?

    Danke dir geändert Post#1!

    Lg Kleiner

  • h2au3

    • Kleiner
    • 10. November 2010 um 23:15

    Hi!

    Finde ich sehr schöne Idee, habe gerade ein Test gemacht, durchgefallen,.
    MSDN
    DWORD WINAPI GetFileAttributes (
    __in LPCTSTR lpFileName
    );

    Dein Progi

    Func ($lpFileName)

    Local $aRes = DllCall ($kernel32dll, "DWORD", "", _
    "WSTR", $lpFileName)
    Return $aRes[0]

    EndFunc

    Ich bin gespant wie sich dein Progi entwickelt! ^^

    Lg Kleiner

  • ArrayUnique ohne Bug´s und Schneller

    • Kleiner
    • 10. November 2010 um 23:01

    Hi!


    UEZ hab natürlich dich gemeint :D !

    Wie Nuts schon Schreibt laut Funktion soll ein 1D Array zurückgegeben werden.
    Davon ab ich habe ein Funktion geschriebne _ObjektAr2DDubDel die das selbe macht , auch 2D Array´s u. ein Extra das noch Sortiert wird , nur allein die Idee der Funktion ( Algo) die hinter _ArrayUnique steckt finde ich sehr schön, das in dieser Funktion von den Autoren überflüssige abfragen und schleifen eingebaut wurden kann ich nicht nachvollziehen aber gute.

    Lg Kleiner

  • ArrayUnique ohne Bug´s und Schneller

    • Kleiner
    • 10. November 2010 um 19:03

    Hi Leute!

    Duch den Post Array Ergenisse nur 1 mal sind UEZ ;) , Großvater und ich auf Bugs gestoßen und bemerkt das die Funktion ziemlich langsam ist !

    Basteln Basteln Fertig.

    Updat: Bug behoben dank an Großvater

    Neue Versaion ArrayUnique:

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _ArrayUnique
    ; Description ...: Returns the Unique Elements of a 1-dimensional array.
    ; Syntax.........: _ArrayUnique($aArray[, $iDimension = 1[, $iBase = 0[, $iCase = 0[, $vDelim = "|"]]]])
    ; Parameters ....: $aArray - The Array to use
    ; $iDimension - [optional] The Dimension of the Array to use
    ; $iBase - [optional] Is the Array 0-base or 1-base index. 0-base by default
    ; $iCase - [optional] Flag to indicate if the operations should be case sensitive.
    ; 0 = not case sensitive, using the user's locale (default)
    ; 1 = case sensitive
    ; 2 = not case sensitive, using a basic/faster comparison
    ; $vDelim - [optional] One or more characters to use as delimiters. However, cannot forsee its usefullness
    ; $iFlag - flag = 0 (default), it acts each included in the delimiter character as a separator mark
    ; flag = 1, it is the entire separator string used as a separator mark
    ; flag = 2, turned off the return of the number in the first element. Thus, the array is 0-based.
    ; It has to be now UBound () the size of the array.
    ; Return values .: Success - Returns a 1-dimensional array containing only the unique elements of that Dimension
    ; Failure - Returns 0 and Sets @Error:
    ; 0 - No error.
    ; 1 - Returns 0 if parameter is not an array.
    ; 2 - Array dimension is invalid, should be an integer greater than 0
    ; Author ........: SmOke_N
    ; Modified.......: litlmike, [Kleiner & Großvater & UEZ (:.AutoIT.de.:)]
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func __ArrayUnique(Const ByRef $aArray, $iDimension = 0, Const $iBase = 0, Const $iCase = 0, $vDelim = '|', Const $iFlag = 0)
    If Not IsArray($aArray) Or UBound($aArray, 0) > 2 Then Return SetError(1, 0, -1)
    If ($iFlag < 0 Or $iFlag > 2) Then Return SetError(3, 0, -2)
    If ($vDelim = '|' Or Not $vDelim) Then $vDelim = Chr(01)
    Local $iUboundDim = UBound($aArray)
    Local $sHold
    If Not UBound($aArray, 2) Then
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold & $vDelim, $vDelim & $aArray[$I] & $vDelim, $iCase) Then $sHold &= $vDelim & $aArray[$I]
    Next
    Else
    If ($iDimension > (UBound($aArray, 2) - 1) Or $iDimension < 0) Then Return SetError(3, 0, -2)
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold & $vDelim, $vDelim & $aArray[$I][$iDimension] & $vDelim, $iCase) Then $sHold &= $vDelim & $aArray[$I][$iDimension]
    Next
    EndIf
    If $sHold Then Return StringSplit(StringTrimLeft($sHold, StringLen($vDelim)), $vDelim, $iFlag)
    Return SetError(2, 0, 0)
    EndFunc ;==>__ArrayUnique

    [/autoit]

    Lg Kleiner

    Dateien

    _ArrayUnique.au3 3,26 kB – 557 Downloads
  • Icon auf Bild

    • Kleiner
    • 10. November 2010 um 17:23

    Hi!

    Nicht ganz ich meine... habe dazu schon ein Post in der Hilfe schau mal rein!


    Lg Kleiner

  • Array Ergenisse nur 1 mal

    • Kleiner
    • 10. November 2010 um 17:21

    Hi!

    UEZ
    Stimmt hast recht, bug behoben! ^^

    Spoiler anzeigen
    [autoit]

    Func ___ArrayUnique(Const ByRef $aArray, $iDimension = 0, Const $iBase = 0, Const $iCase = 0, $vDelim = "|")
    If Not IsArray($aArray) Then Return SetError(1, 0, 0)
    If ($iDimension > 2) Or ($iDimension < 0) Then Return SetError(3, 0, 0)
    If ($vDelim = '|') Then $vDelim = Chr(01)
    Local $iUboundDim = UBound($aArray)
    Local $sHold
    If Not UBound($aArray, 2) Then
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I], $iCase) Then $sHold &= $aArray[$I] & $vDelim
    Next
    Else
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I][$iDimension], $iCase) Then $sHold &= $aArray[$I][$iDimension] & $vDelim
    Next
    EndIf
    If $sHold Then Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2)
    Return SetError(2, 0, 0)
    EndFunc ;==>___ArrayUnique

    [/autoit]

    Lg Kleiner

  • Array Ergenisse nur 1 mal

    • Kleiner
    • 10. November 2010 um 15:37

    Hi!


    Meine Version! ;)

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    Dim $aNames[10] = ["Anton", "Berta", "Cäsar", "Dora", "Emil", "Friedrich", "Gustav", "Heinrich", "Ida", "Julius"]
    ;Dim $aNames[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    Dim $aUnique[10000]
    For $I = 0 To UBound($aUnique) - 1
    $aUnique[$I] = $aNames[Random(0, 9, 1)]
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Dim $T1 = 0, $T2 = 0
    For $I = 1 To 20
    $T = TimerInit()
    $aTemp1 = ___ArrayUnique($aUnique)
    $T1 += TimerDiff($T)
    $T = TimerInit()
    $aTemp2 = _ArrayUnique2($aUnique)
    $T2 += TimerDiff($T)
    Next
    _ArrayDisplay($aTemp1, Round($T1) & " ms")
    _ArrayDisplay($aTemp2, Round($T2) & " ms")
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _ArrayUnique2(Const ByRef $aA)
    Local Static $oD = ObjCreate('Scripting.Dictionary')
    For $I In $aA
    If Not $oD.Exists($I) Then $oD.Add($I, 0)
    Next
    Local $aR = $oD.Keys()
    $oD.RemoveAll
    Return $aR
    EndFunc ;==>_ArrayUnique2

    [/autoit] [autoit][/autoit] [autoit]

    Func ___ArrayUnique(Const ByRef $aArray, $iDimension = 1, Const $iBase = 0, Const $iCase = 0, $vDelim = "|")
    If Not IsArray($aArray) Then Return SetError(1, 0, 0)
    If Not $iDimension Then Return SetError(3, 0, 0)
    If ($vDelim = '|') Then $vDelim = Chr(01)
    Local $iUboundDim = UBound($aArray)
    Local $sHold
    If (UBound($aArray, 0) = 1) Then
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I], $iCase) Then $sHold &= $aArray[$I] & $vDelim
    Next
    Else
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I][$iDimension - 1], $iCase) Then $sHold &= $aArray[$I][$iDimension - 1] & $vDelim
    Next
    EndIf
    If $sHold Then Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2)
    Return SetError(2, 0, 0)
    EndFunc ;==>___ArrayUnique

    [/autoit]

    Edit: wie gerade feststellen musste arbeitet die Angepaste Version nich einwandfrei bei Zahlen. :S

    Edit2: Haben den Bug gefunden Jetzt alles Gut :D

    Lg Kleiner

  • Inhalt ALLER Input Controls auf einmal löschen ?

    • Kleiner
    • 10. November 2010 um 14:38

    Hi!

    Alle Variablen mit For Next Ctrl löschen GUICtrlSetData($Var,'') !


    Lg Kleiner

  • Button Unschön auf ein Grafischen Hintergrund

    • Kleiner
    • 10. November 2010 um 12:49

    Hi!

    Habe gerade den Post Icon auf Bild gelesen und dachte an ein altes Leiden :rolleyes: mit den Button, ich habe hin und wieder mal nach einer Möglichkeit gesucht, bis jetzt nichts gefunden.
    Beispiel Färbet man den Hintergrund der Form ganz normal mit GUISetBkColor ist alles gut, Setzt ich aber mit GUICtrlSetGraphic eine Grafik und darüber ein Button " Bilder sagen alles, einmal mit schwarz einmal mit weiß"

    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Ein beispiel Code:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $aWColor[3] = [50, 125, 300], $aLColor[3] = [25, 255, 255]
    $guiBox = GUICreate('', 500, 500, -1, -1)
    ;GUISetBkColor('')
    ;GUISetBkColor(0x1788A7)
    GUICtrlCreateButton('0', 50, 50, 150, 50)
    GUICtrlCreateButton('1', 50, 150, 150, 50)
    GUICtrlCreateButton('2', 50, 250, 150, 50)
    GUICtrlCreateButton('3', 50, 350, 150, 50)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateButton('3', 250, 50, 100, 40)
    GUICtrlCreateButton('4', 250, 150, 70, 30)
    GUICtrlCreateButton('5', 250, 250, 50, 20)
    GUICtrlCreateButton('6', 250, 350, 20, 15)

    [/autoit] [autoit][/autoit] [autoit]

    If SetBkColor(GUICtrlCreateGraphic(0, 0, 500, 500), 500, 500, $aWColor, $aLColor) Then GUISetState()
    ;GUISetState()
    Do

    [/autoit] [autoit][/autoit] [autoit]

    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func SetBkColor($hGraphic, $Width, $Height, $lc, $rc)
    If ($hGraphic And $Width And $Height And IsArray($lc) And IsArray($rc)) Then
    For $i = 0 To $Height
    GUICtrlSetGraphic($hGraphic, 8, Dec(Hex(($lc[0] - Floor($i * ($lc[0] - $rc[0]) / $Height)), 2) & _
    Hex(($lc[1] - Floor($i * ($lc[1] - $rc[1]) / $Height)), 2) & Hex(($lc[2] - Floor($i * ($lc[2] - $rc[2]) / $Height)), 2)))
    GUICtrlSetGraphic($hGraphic, 6, 0, $i)
    GUICtrlSetGraphic($hGraphic, 2, $Width, $i)
    Next
    Return GUICtrlSetGraphic($hGraphic, 22)
    EndIf
    Return False
    EndFunc ;==>SetBkColor

    [/autoit]

    Kennt da vielleicht einer eine Möglichkeit den Rand Transparent o. weg zu bekommen?


    Lg Kleiner

    Dateien

    Unbenannt.JPG 27,68 kB – 0 Downloads Unbenannt1.JPG 24,74 kB – 0 Downloads
  • Icon auf Bild

    • Kleiner
    • 10. November 2010 um 12:16

    Hi!


    Wo wir gerade bei den unschönen stellen sind, gibt es auch eine Möglichkeit bie ganz normale Button die haben auch immer ein Unschönen Rand?


    Lg Kleiner

  • SpeedStarter

    • Kleiner
    • 10. November 2010 um 11:50

    Hi!


    Ich finde die Idee sehr schön gelungen!
    Das was ich vorschlage würde, nicht den ganzen Bildschirm auszugrauen!


    Lg Kleiner

  • Array Ergenisse nur 1 mal

    • Kleiner
    • 9. November 2010 um 22:09

    Hi!


    Ja gibt eine Möglichkeit Array #include die Funktion _ArrayUnique suchen und StrinSplit ändern !
    Oder rauskopieren und zu deinen Bedürfnissen anpassen.

    Lg Kleiner

  • "Netto" wird in GUI nicht errechnet

    • Kleiner
    • 9. November 2010 um 16:28

    Hi!


    Vor den Ctrl eine Variable und mit GUICtrlRead auslesen und Berechen, Code kannst du auch kürzen mit Array!


    Lg Kleiner

  • Info in einer GUI

    • Kleiner
    • 8. November 2010 um 18:42

    Hi!

    Habe mich wohl vom [ offen ] Hover flackert Post Beeinflussen lassen ^^


    Lg Kleiner

  • bild direkt einfügen

    • Kleiner
    • 8. November 2010 um 18:21

    Hi!


    Temporäre Dateien (im Computer-Slang oft auch Tempfiles genannt) sind Arbeitsdateien, die vom Betriebssystem oder von anderen Programmen verwendet werden und zur zeitlich begrenzten Zwischenspeicherung von Daten dienen. ;)


    Lg Kleiner

  • Info in einer GUI

    • Kleiner
    • 8. November 2010 um 18:17

    Hi!

    Das ist aus der UDF die ich liegen habe!

    Spoiler anzeigen
    [autoit]

    #include <GUICtrlSetOnHover_UDF.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hParent_GUI = GUICreate("Parent & Child Example", 280, 200)

    [/autoit] [autoit][/autoit] [autoit]

    $Parent_Button = GUICtrlCreateButton("Button", 20, 160, 100, 20)
    _GUICtrl_SetOnHover(-1, "_Hover_Func", "_Leave_Hover_Func")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $hChild_GUI = GUICreate("Child", 150, 100, -1, -1, -1, -1, $hParent_GUI)

    [/autoit] [autoit][/autoit] [autoit]

    $Child_Button = GUICtrlCreateButton("Button", 20, 20, 100, 20)
    _GUICtrl_SetOnHover(-1, "_Hover_Func", "_Leave_Hover_Func")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $Parent_Button, $Child_Button
    If BitAND(WinGetState($hChild_GUI), 2) Then
    GUISetState(@SW_HIDE, $hChild_GUI)
    Else
    GUISetState(@SW_SHOW, $hChild_GUI)
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Hover_Func($CtrlID)
    Switch $CtrlID
    Case $Parent_Button, $Child_Button
    If GUICtrlRead($CtrlID) <> "Show/Hide Child" Then GUICtrlSetData($CtrlID, "Show/Hide Child")
    EndSwitch
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Leave_Hover_Func($CtrlID)
    Switch $CtrlID
    Case $Parent_Button, $Child_Button
    If GUICtrlRead($CtrlID) <> "Button" Then GUICtrlSetData($CtrlID, "Button")
    EndSwitch
    EndFunc

    [/autoit]
    Spoiler anzeigen
    [autoit]

    #include-once

    [/autoit] [autoit][/autoit] [autoit]

    ;_GUICtrl_SetOnHover Global Variables
    Global $aHOVER_CONTROLS_ARRAY[1][1]
    Global $aLAST_HOVERED_ELEMENT[2] = [-1, -1]
    Global $aLAST_HOVERED_ELEMENT_MARK = -1
    Global $hLAST_CLICKED_ELEMENT_MARK = -1
    Global $iHOVER_CONTROLS_MODIFIED = 0
    Global $iHOVER_ON_BACKGROUND_WINDOW = 1
    Global $iLAST_PRIMARYDOWN_CTRLID = 0

    [/autoit] [autoit][/autoit] [autoit]

    Global $__GUICtrl_SetOnHover_pTimerProc = 0
    Global $__GUICtrl_SetOnHover_iTimerID = 0

    [/autoit] [autoit][/autoit] [autoit]

    Global $__GUICtrl_SetOnHover_sOriginal_OnExitFunc = Opt("OnExitFunc", "__GUICtrl_SetOnHover_OnAutoItExit")

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $__GUICtrl_SetOnHover_WM_COMMAND = 0x0111
    Global Const $__GUICtrl_SetOnHover_WM_LBUTTONDOWN = 0x0201

    [/autoit] [autoit][/autoit] [autoit]

    #Region =================== UDF Info ===================
    ; UDF Name: _GUICtrl_SetOnHover
    ; Forum link: http://www.autoitscript.com/forum/index.php?s=&showtopic=55120
    ; Author: G.Sandler a.k.a MrCreatoR (CreatoR's Lab, http://creator-lab.ucoz.ru)
    ;
    ;
    ; {Version History}:
    ;
    ; [v1.8] - [28.09.2009]
    ; * Few Global variables now have more unique name.
    ; * Fixed an issue with false calling of function on PrimaryDown event. I.e when the user clicks on other place (not on the hovered control) and drag the cursor to the control, the PrimaryDown function was called.
    ; * Due to (and as a result of) previous issue, the UDF now registering WM_COMMAND and WM_LBUTTONDOWN messages at first UDF call.
    ;
    ;
    ; [v1.7] - [07.07.2009]
    ; + Added _GUICtrl_SetHoverOnBackWindow...
    ; Allows to set the hovering mode:
    ; $iSetBackWin = 1 (default) hovering process will proceed even when GUI is not active (in background).
    ; $iSetBackWin <> 1 hovering process will NOT proceed when GUI is not active.
    ;
    ;
    ; [v1.6] - [12.06.2009]
    ; * Now the UDF compatible with scripts (or other udfs) that uses OnAutoItExit function.
    ; i.e: "OnAutoItExit" function that was *previously* set by user will be called as well.
    ;
    ; + Added new parameter $iKeepCall_Hover_Func. If this parameter = 1,
    ; then the $sHover_Func function *Will* be called constantly untill the control is no longer been hovered
    ; (default is 0, do not call the function constantly).
    ; + Added new arguments to calling function...
    ; The OnPrimaryDown/Up function now can recieve one more argument:
    ; $iClickMode - Defines the Click mode (1 - Pressed, 2 - Released)
    ;
    ; Changed return value - function will return 2 when $iCtrlID is redefined (ReSet, already exists in the controls list).
    ;
    ; Fixed incorrect documentation parts.
    ; Fixed "OnClick" handeling. When using multiple GUIs, the active gui was not recognized properly.
    ; Fixed(?) bug with "dimension range exceeded" when trying to UnSet a Control.
    ;
    ; [v1.5]
    ; + Added AutoIt 3.2.10.0+ support, but 3.2.8.1 or less is dropped :( (due to lack of native CallBack functions).
    ; + Added Primary Down and Primary Up support. Helping to handle with the buttons pressing.
    ; + Added new arguments to calling function...
    ; The OnHover function now can recieve two more arguments:
    ; $iHoverMode - Defines the hover mode (1 - Hover, 2 - Leaves Hovering)
    ; $hWnd_Hovered - Control Handle where the mouse is moved to (after hovering).
    ;
    ; * Almost all code of this UDF was rewritted.
    ; * Now the main function name is _GUICtrl_SetOnHover(),
    ; but for backwards compatibility reasons, other (old) function names are still supported.
    ; * Fixed bug with hovering controls in other apps.
    ; * Improvements in generaly, the UDF working more stable now.
    ;
    ; [v1.?]
    ; * Beta changes, see "Forum link" for more details.
    ;
    ; [v1.0]
    ; * First release.
    #EndRegion =================== UDF Info ===================
    ;

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _GUICtrl_SetOnHover()
    ; Description: Set function(s) to call when hovering/leave hovering GUI elements.
    ;
    ; Parameter(s): $iCtrlID - The Ctrl ID to set hovering for (can be a -1 as indication to the last item created).
    ;
    ; $sHover_Func - [Optional] Function to call when the mouse is hovering the control.
    ; If this parameter passed as empty string (""),
    ; then the specified CtrlID is UnSet from Hovering Handler list.
    ;
    ; $sLeaveHover_Func - [Optional] Function to call when the mouse is leaving hovering the control
    ; (-1 no function used).
    ; * For both parameters, $sHover_FuncName and $sLeaveHover_FuncName,
    ; the specified function called with maximum 3 parameters:
    ; $iCtrlID - CtrlID of hovered control.
    ; $iHoverMode - Defines the hover mode (1 - Hover, 2 - Leaves Hovering).
    ; $hWnd_Hovered - Control Handle where the mouse is moved to (after hovering).
    ;
    ; $sPrimaryDownFunc - [Optional] Function to call when Primary mouse button is *clicked* on the control.
    ; (-1 -> function is not called).
    ;
    ; $sPrimaryUpFunc - [Optional] Function to call when Primary mouse button is *released* the control.
    ; (-1 -> function is not called).
    ;
    ; * For both parameters, $sPrimaryDownFunc and $sPrimaryUpFunc,
    ; the specified function called with maximum 2 parameters:
    ; $iCtrlID - CtrlID of clicked control.
    ; $iClickMode - Defines the click mode (1 - Pressed, 2 - Released).
    ;
    ; $iKeepCall_PrDn_Func - [Optional] If this parameter < 1,
    ; then the $sPrimaryDownFunc function will *Not* be called constantly untill
    ; the primary mouse button is released (default behaviour - $iKeepCall_PrDn_Func = 1).
    ;
    ; $iKeepCall_Hover_Func - [Optional] If this parameter = 1,
    ; then the $sHover_Func function *Will* be called constantly untill
    ; the control is no longer been hovered (default behaviour - $iKeepCall_Hover_Func = 0).
    ;
    ; Return Value(s): Always returns 1, except when $iCtrlID is redefined (ReSet, already exists in the controls list),
    ; in this case the return value is 2.
    ;
    ; Requirement(s): AutoIt 3.2.10.0 +
    ;
    ; Note(s): 1) TreeView/ListView Items can not be set :(.
    ; 2) When the window is not active, the hover/leave hover functions will still called,
    ; but not when the window is disabled.
    ; 3) The hover/leave hover functions will be called even if the script is paused by such functions as MsgBox().
    ; 4) It is not recommended to block the HoverFunc by calling functions like Sleep() or MsgBox().
    ; 5) This UDF registering WM_COMMAND and WM_LBUTTONDOWN messages.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR).
    ;
    ;===============================================================================
    Func _GUICtrl_SetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCall_PrDn_Func=1, $iKeepCall_Hover_Func=0)
    Local $hCtrlID = GUICtrlGetHandle($iCtrlID)

    [/autoit] [autoit][/autoit] [autoit]

    If $__GUICtrl_SetOnHover_pTimerProc = 0 Then
    $__GUICtrl_SetOnHover_pTimerProc = DllCallbackRegister("__MAIN_CALLBACK_ONHOVER_PROC", "none", "hwnd;int;int;dword")
    $__GUICtrl_SetOnHover_iTimerID = DllCall("User32.dll", "int", "SetTimer", "hwnd", 0, _
    "int", TimerInit(), "int", 10, "ptr", DllCallbackGetPtr($__GUICtrl_SetOnHover_pTimerProc))

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($__GUICtrl_SetOnHover_WM_COMMAND, "__GUICtrl_SetOnHover_WM_COMMAND")
    GUIRegisterMsg($__GUICtrl_SetOnHover_WM_LBUTTONDOWN, "__GUICtrl_SetOnHover_WM_LBUTTONDOWN")

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($__GUICtrl_SetOnHover_iTimerID) Then $__GUICtrl_SetOnHover_iTimerID = $__GUICtrl_SetOnHover_iTimerID[0]
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;UnSet Hovering for specified control (remove control id from hovering checking process)
    If $sHover_Func = "" And @NumParams <= 2 Then
    Local $aHOVER_CONTROLS_Tmp[1][1]
    Local $aHOVER_CONTROLS_Swap = $aHOVER_CONTROLS_ARRAY ;This one prevents a bug with "dimension range exceeded"

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aHOVER_CONTROLS_Swap[0][0]
    If $hCtrlID <> $aHOVER_CONTROLS_Swap[$i][0] Then
    $aHOVER_CONTROLS_Tmp[0][0] += 1
    ReDim $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]+1][7]

    [/autoit] [autoit][/autoit] [autoit]

    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][0] = $aHOVER_CONTROLS_Swap[$i][0]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][1] = $aHOVER_CONTROLS_Swap[$i][1]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][2] = $aHOVER_CONTROLS_Swap[$i][2]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][3] = $aHOVER_CONTROLS_Swap[$i][3]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][4] = $aHOVER_CONTROLS_Swap[$i][4]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][5] = $aHOVER_CONTROLS_Swap[$i][5]
    $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][6] = $aHOVER_CONTROLS_Swap[$i][6]
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    If $aHOVER_CONTROLS_Tmp[0][0] < 1 Then
    __GUICtrl_SetOnHover_ReleaseResources_Proc() ;Release the callbacks
    Else
    $iHOVER_CONTROLS_MODIFIED = 1
    $aHOVER_CONTROLS_ARRAY = $aHOVER_CONTROLS_Tmp
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;Check if the hovering process already handle the passed CtrlID, if so, just assign new values (functions)
    For $i = 1 To $aHOVER_CONTROLS_ARRAY[0][0]
    If $hCtrlID = $aHOVER_CONTROLS_ARRAY[$i][0] Then
    $aHOVER_CONTROLS_ARRAY[$i][0] = $hCtrlID
    $aHOVER_CONTROLS_ARRAY[$i][1] = $sHover_Func
    $aHOVER_CONTROLS_ARRAY[$i][2] = $sLeaveHover_Func
    $aHOVER_CONTROLS_ARRAY[$i][3] = $sPrimaryDownFunc
    $aHOVER_CONTROLS_ARRAY[$i][4] = $sPrimaryUpFunc
    $aHOVER_CONTROLS_ARRAY[$i][5] = $iKeepCall_PrDn_Func
    $aHOVER_CONTROLS_ARRAY[$i][6] = $iKeepCall_Hover_Func

    [/autoit] [autoit][/autoit] [autoit]

    Return 2
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $aHOVER_CONTROLS_ARRAY[0][0] += 1
    ReDim $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]+1][7]

    [/autoit] [autoit][/autoit] [autoit]

    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][0] = $hCtrlID
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][1] = $sHover_Func
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][2] = $sLeaveHover_Func
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][3] = $sPrimaryDownFunc
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][4] = $sPrimaryUpFunc
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][5] = $iKeepCall_PrDn_Func
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][6] = $iKeepCall_Hover_Func

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Backwards compatibility function #1
    Func GUICtrl_SetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCall_PrDn_Func=1, $iKeepCall_Hover_Func=0)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCall_PrDn_Func, $iKeepCall_Hover_Func)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Backwards compatibility function #2
    Func GUICtrlSetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCall_PrDn_Func=1, $iKeepCall_Hover_Func=0)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCall_PrDn_Func, $iKeepCall_Hover_Func)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Backwards compatibility function #3
    Func _GUICtrlSetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCall_PrDn_Func=1, $iKeepCall_Hover_Func=0)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCall_PrDn_Func, $iKeepCall_Hover_Func)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Set the hovering mode:
    ; $iSetBackWin = 1 (default) hovering process will proceed even when GUI is not active (in background).
    ; $iSetBackWin <> 1 hovering process will NOT proceed when GUI is not active.
    Func _GUICtrl_SetHoverOnBackWindow($iSetBackWin)
    $iHOVER_ON_BACKGROUND_WINDOW = Number($iSetBackWin = 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;CallBack function to handle the hovering process
    Func __MAIN_CALLBACK_ONHOVER_PROC($hWnd, $uiMsg, $idEvent, $dwTime)
    $iHOVER_CONTROLS_MODIFIED = 0

    [/autoit] [autoit][/autoit] [autoit]

    If $aHOVER_CONTROLS_ARRAY[0][0] < 1 Then Return

    [/autoit] [autoit][/autoit] [autoit]

    If $iHOVER_ON_BACKGROUND_WINDOW Then
    Local $iControl_Hovered = _ControlGetHovered()
    Else
    Local $iControl_Hovered = GUIGetCursorInfo()
    If Not IsArray($iControl_Hovered) Then Return

    [/autoit] [autoit][/autoit] [autoit]

    $iControl_Hovered = GUICtrlGetHandle($iControl_Hovered[4])
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $sCheck_LHE = $aLAST_HOVERED_ELEMENT[1]
    Local $iCheck_LCEM = $hLAST_CLICKED_ELEMENT_MARK
    Local $iCtrlID

    [/autoit] [autoit][/autoit] [autoit]

    ;Leave Hovering Process and reset variables
    If Not $iControl_Hovered Or ($sCheck_LHE <> -1 And $iControl_Hovered <> $sCheck_LHE) Then
    If $aLAST_HOVERED_ELEMENT_MARK = -1 Then Return

    [/autoit] [autoit][/autoit] [autoit]

    If $aLAST_HOVERED_ELEMENT[0] <> -1 Then
    $iCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $aLAST_HOVERED_ELEMENT[1])
    If IsArray($iCtrlID) Then $iCtrlID = $iCtrlID[0]

    [/autoit] [autoit][/autoit] [autoit]

    ;2 is the indicator of OnLeavHover process
    __GUICtrl_SetOnHover_Call_Proc($aLAST_HOVERED_ELEMENT[0], $iCtrlID, 2, $iControl_Hovered)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $aLAST_HOVERED_ELEMENT[0] = -1
    $aLAST_HOVERED_ELEMENT[1] = -1
    $aLAST_HOVERED_ELEMENT_MARK = -1
    $hLAST_CLICKED_ELEMENT_MARK = -1
    Else ;Hovering Process, Primary Down/Up handler, and set LAST_HOVERED_ELEMENT
    If $iHOVER_CONTROLS_MODIFIED = 1 Then
    $iHOVER_CONTROLS_MODIFIED = 0
    Return
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $iUbound = UBound($aHOVER_CONTROLS_ARRAY)-1

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aHOVER_CONTROLS_ARRAY[0][0]
    If $i > $iUbound Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    If $aHOVER_CONTROLS_ARRAY[$i][0] = $iControl_Hovered Then
    $iCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $iControl_Hovered)
    If IsArray($iCtrlID) Then $iCtrlID = $iCtrlID[0]

    [/autoit] [autoit][/autoit] [autoit]

    ;Primary Down/Up handler
    If ($aHOVER_CONTROLS_ARRAY[$i][3] <> "" Or $aHOVER_CONTROLS_ARRAY[$i][4] <> "") And _
    ($iCheck_LCEM = -1 Or $iCheck_LCEM = $iControl_Hovered) Then

    [/autoit] [autoit][/autoit] [autoit]

    Local $aCursorInfo = 0
    Local $hParent_Wnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $iControl_Hovered)

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error And IsArray($hParent_Wnd) Then
    $hParent_Wnd = $hParent_Wnd[0]
    $aCursorInfo = GUIGetCursorInfo($hParent_Wnd)
    Else
    $aCursorInfo = GUIGetCursorInfo()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aCursorInfo) Then
    ;Primary Down...
    ;* First condition is to prevent function call when holding down m.button from other control
    ;* Last condition is to Prevent/Allow multiple function call
    ;(depending on $iKeepCall_PrDn_Func param).
    If $iLAST_PRIMARYDOWN_CTRLID = $iControl_Hovered And WinActive($hParent_Wnd) And _
    $aCursorInfo[2] = 1 And $aHOVER_CONTROLS_ARRAY[$i][3] <> -1 And _
    (($aHOVER_CONTROLS_ARRAY[$i][5] < 1 And $iCheck_LCEM <> $iControl_Hovered) Or _
    $aHOVER_CONTROLS_ARRAY[$i][5] > 0) Then

    [/autoit] [autoit][/autoit] [autoit]

    ;1 is the indicator of Primary*Down* event
    __GUICtrl_SetOnHover_Call_Proc($aHOVER_CONTROLS_ARRAY[$i][3], $iCtrlID, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $hLAST_CLICKED_ELEMENT_MARK = $iControl_Hovered
    ElseIf $aCursorInfo[2] = 0 And $aHOVER_CONTROLS_ARRAY[$i][4] <> -1 And _ ;Primary Up
    $iCheck_LCEM = $iControl_Hovered Then

    [/autoit] [autoit][/autoit] [autoit]

    ;2 is the indicator of Primary*Up* event
    __GUICtrl_SetOnHover_Call_Proc($aHOVER_CONTROLS_ARRAY[$i][4], $iCtrlID, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $hLAST_CLICKED_ELEMENT_MARK = -1
    EndIf
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $iHOVER_CONTROLS_MODIFIED = 1 Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    If $aHOVER_CONTROLS_ARRAY[$i][6] < 1 And $aLAST_HOVERED_ELEMENT_MARK = $aHOVER_CONTROLS_ARRAY[$i][0] Then
    ExitLoop
    Else
    $aLAST_HOVERED_ELEMENT_MARK = $aHOVER_CONTROLS_ARRAY[$i][0]
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    __GUICtrl_SetOnHover_Call_Proc($aHOVER_CONTROLS_ARRAY[$i][1], $iCtrlID, 1, 0) ;1 is the indicator of OnHover process

    [/autoit] [autoit][/autoit] [autoit]

    If $iHOVER_CONTROLS_MODIFIED = 1 Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    If $aHOVER_CONTROLS_ARRAY[$i][2] <> -1 Then
    $aLAST_HOVERED_ELEMENT[0] = $aHOVER_CONTROLS_ARRAY[$i][2]
    $aLAST_HOVERED_ELEMENT[1] = $iControl_Hovered
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ExitLoop
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $iHOVER_CONTROLS_MODIFIED = 0
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __GUICtrl_SetOnHover_WM_COMMAND($hWndGUI, $MsgID, $WParam, $LParam)
    $iLAST_PRIMARYDOWN_CTRLID = $LParam
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __GUICtrl_SetOnHover_WM_LBUTTONDOWN($hWndGUI, $MsgID, $WParam, $LParam)
    $iLAST_PRIMARYDOWN_CTRLID = 0
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Thanks to amel27 for that one!!!
    Func _ControlGetHovered()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("User32.dll", "int", "WindowFromPoint", _
    "long", MouseGetPos(0), _
    "long", MouseGetPos(1))

    [/autoit] [autoit][/autoit] [autoit]

    ;$aRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $aRet[0])

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", $iOld_Opt_MCM)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Call() function wrapper
    Func __GUICtrl_SetOnHover_Call_Proc($sFunction, $sParam1="", $sParam2="", $sParam3="", $sParam4="", $sParam5="")
    Local $sCall_Params = 'Call("' & $sFunction & '"'
    Local $sEval = ''

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 2 To @NumParams
    $sEval = Eval("sParam" & $i-1)

    [/autoit] [autoit][/autoit] [autoit]

    If IsNumber($sEval) Then
    $sCall_Params &= ', Number(' & $sEval & ')'
    Else
    $sCall_Params &= ', "' & $sEval & '"'
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    If @NumParams < 2 Then $sCall_Params &= '"'
    $sCall_Params &= ')'

    [/autoit] [autoit][/autoit] [autoit]

    Local $iRet = Execute($sCall_Params)
    Local $iError = @error

    [/autoit] [autoit][/autoit] [autoit]

    While $iError <> 0
    $sCall_Params = StringRegExpReplace($sCall_Params, '(.*), .*\)$', '\1)', 1)
    If @extended = 0 Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    $iRet = Execute($sCall_Params)
    $iError = @error
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Return SetError($iError, 0, $iRet)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Release resources function
    Func __GUICtrl_SetOnHover_ReleaseResources_Proc()
    If $__GUICtrl_SetOnHover_pTimerProc > 0 Then DllCallbackFree($__GUICtrl_SetOnHover_pTimerProc)
    If $__GUICtrl_SetOnHover_iTimerID > 0 Then _
    DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $__GUICtrl_SetOnHover_iTimerID)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($__GUICtrl_SetOnHover_WM_COMMAND, "")
    GUIRegisterMsg($__GUICtrl_SetOnHover_WM_LBUTTONDOWN, "")

    [/autoit] [autoit][/autoit] [autoit]

    $__GUICtrl_SetOnHover_pTimerProc = 0
    $__GUICtrl_SetOnHover_iTimerID = 0
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;Release the CallBack resources when exit
    Func __GUICtrl_SetOnHover_OnAutoItExit()
    Call($__GUICtrl_SetOnHover_sOriginal_OnExitFunc)

    [/autoit] [autoit][/autoit] [autoit]

    __GUICtrl_SetOnHover_ReleaseResources_Proc()
    EndFunc

    [/autoit]

    Ich bau mir meine eignen sachen!

    Lg Kleiner

  • Hover flackert

    • Kleiner
    • 8. November 2010 um 18:12

    Hi!


    Bei mir flackert nichts?
    Edit:/ :whistling:
    Lg Kleiner

  • bild direkt einfügen

    • Kleiner
    • 8. November 2010 um 18:07

    Hi!


    Ja kannst du Binär, aber wenn du sie Anzeigen willst musst du eine Tmp anlegen!


    Lg Kleiner

  • Info in einer GUI

    • Kleiner
    • 8. November 2010 um 18:05

    Hi!


    Mir fallen im ersten moment die Hover_UDF´s ein!


    Lg kleiner

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™