Jump to content
Sign in to follow this  
jfcby

How to get code to work with EzSkin

Recommended Posts

jfcby

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

Share this post


Link to post
Share on other sites
jfcby

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

Share this post


Link to post
Share on other sites
dantay9

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.