Jump to content

How to get code to work with EzSkin


 Share

Recommended Posts

Hi,

I'm tring to get the code below to work with ExSkin but the buttons are not working.

; Code generated by EzSkin_1-2-3, Created by Valuater
; For personal use only, All Rights Reserved
; Author of this code: Valuater
; Thank you big_daddy and Joscpe

#include <GUIConstants.au3>
#include <EzSkin.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#include <Constants.au3>

Opt('TrayMenuMode', 1)
Opt("TrayOnEventMode", 1)
Opt("GuiOnEventMode", 1)

$TrayRestoreItem = TrayCreateItem('Restore')
TrayItemSetState(-1, $TRAY_DEFAULT)
TrayItemSetOnEvent(-1, "TrayRestore")
TrayCreateItem('')
$TrayExitItem = TrayCreateItem('Exit')
TrayItemSetOnEvent(-1, "TrayExit")
TraySetClick(8)

$EzGUI = EzSkinGUICreate("MyEzSkinDemo",400,300)
$EzIcon = EzSkinIcon($EzGUI)

$Button1 = EzSkinButton("Start", 150, 150, 100, 30) ;, $font_color)
GUICtrlSetOnEvent(-1, "StartRunFunc")
$Button2 = EzSkinButton("Exit", 150, 200, 50, 19)
GUICtrlSetOnEvent(-1, "TrayExit")

GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "setToMin")
GUISetOnEvent($GUI_EVENT_CLOSE, "TrayExit")

GUISetState()
Global $DoRF = False    ; do the RunFunction thing
While 1
    EzSkinOver()    
    Sleep(10)
    If $DoRF Then
        function()
        $DoRF = False
    EndIf
    
WEnd

Func TrayExit()
    Exit
EndFunc   ;==>TrayExit

Func TrayRestore()
    ConsoleWrite("restore?" & @CRLF)
    GUISetState(@SW_SHOW, $EzGUI)
    GUISetState(@SW_RESTORE, $EzGUI)
    TraySetState(2)
EndFunc   ;==>TrayRestore

Func setToMin()
    GUISetState(@SW_HIDE, $EzGUI)
    TraySetState(1)

EndFunc   ;==>setToMin


Func StartRunFunc()
    $DoRF = True
EndFunc   ;==>StartRunFunc

Func Function()
    For $n = 1 To 1000
        Sleep(300)
        ConsoleWrite($n & @CRLF)
    Next

EndFunc   ;==>Function

Thnak you for your help,

jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

Hi,

I would like to rephrase my question.

I've searched this forum for xskin examples and the only ones I found were for GUIGetMsg().

1. Is it possible to use xskins with GuiOnEventMode?

2. If so, where can I find examples?

Thank you for your help,

jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

It is possible to use GuiSetOnEvent. That should be just like any other script. You will still have to call MouseOver inside a while loop though. This isn't a very good example, but it proves the concept:

#include <GUIConstants.au3>
#include <XSkin.au3>

Local Const $PBS_MARQUEE = 0x08

Opt("GUIOnEventMode", 1)

$Skin_Folder = @ScriptDir & "\Skins\Universal"
;~ $Icon_Folder = @ScriptDir & "\dat"

$XSkinGui = XSkinGUICreate("Marquee", 200, 100, $Skin_Folder)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

$XIcon = XSkinIcon($XSkinGui, 2)
GUICtrlSetOnEvent($XIcon[1], "GUI_CLOSE")
GUICtrlSetOnEvent($XIcon[2], "GUI_MIN")

$GUI_Progress = XSkinProgress(50, 30, 100, 20)
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000073)
GUICtrlSetStyle($GUI_Progress, $PBS_MARQUEE)



$GUI_Button_Start = GUICtrlCreateButton("Start", 40, 50)
GUICtrlSetOnEvent(-1, "Progress_Start")


$GUI_Combo = GUICtrlCreateCombo("", 78, 52, 50)
GUICtrlSetData(-1, "1|10|50|100|300|500")
GUICtrlSetOnEvent(-1, "Progress_Time")


$GUI_Button_Stop = GUICtrlCreateButton("Stop", 135, 50)
GUICtrlSetOnEvent(-1, "Progress_Stop")
GUISetState()

While 1
    Sleep(100)
WEnd


Func Progress_Start()
    _GUICtrlProgressSetMarquee($GUI_Progress)
EndFunc   ;==>Progress_Start

Func Progress_Stop()
    _GUICtrlProgressSetMarquee($GUI_Progress, 0)
EndFunc   ;==>Progress_Stop

Func Progress_Time()
    $iTime = GUICtrlRead($GUI_Combo)
    _GUICtrlProgressSetMarquee($GUI_Progress, 1, $iTime)
EndFunc   ;==>Progress_Time

Func GUI_MIN()
    GUISetState(@SW_MINIMIZE)
EndFunc   ;==>GUI_MIN

Func GUI_CLOSE()
    Exit
EndFunc   ;==>GUI_CLOSE



;===============================================================================
;
; Function Name:    _GUICtrlProgressSetMarquee()
; Description:    Sets marquee sytle for a progress control
; Parameter(s):  $h_Progress  - The control identifier (controlID)
;               $f_Mode        - Optional: Indicates whether to turn the marquee mode on or off
;                           0 = turn marquee mode off
;                           1 = (Default) turn marquee mode on
;               $i_Time        - Optional: Time in milliseconds between marquee animation updates
;                           Default is 100 milliseconds
; Requirement(s):   AutoIt3 Beta and Windows XP or later
; Return Value(s):  On Success - Returns whether marquee mode is set
;               On Failure - Returns 0  and sets @ERROR = 1
; Author(s):        Bob Anthony
;
;===============================================================================
;
Func _GUICtrlProgressSetMarquee($h_Progress, $f_Mode = 1, $i_Time = 100)

    Local Const $WM_USER = 0x0400
    Local Const $PBM_SETMARQUEE = ($WM_USER + 10)

    Local $var = GUICtrlSendMsg($h_Progress, $PBM_SETMARQUEE, $f_Mode, Number($i_Time))
    If $var = 0 Then
        SetError(1)
        Return 0
    Else
        SetError(0)
        Return $var
    EndIf

EndFunc   ;==>_GUICtrlProgressSetMarquee
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...