Jump to content

XSkin.au3... Skin your GUI


Valuater
 Share

Recommended Posts

read a lot of examples, but for now can't figure how start my skin,

nobody help me only to apply jpg over a button ? (to start learn)

Thank you,

m.

I Like you effort here in the Forums with the stuff you are trying to do. So, I put this together for you, it needs some refining on the letters...but....

Posted Image

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <_ControlHover.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global $B[10], $Time, $Wait, $Voice = 0, $action = " Numbers"
Global $Info_Read = "Dave 555-1255|Cindy 447-4145|Ray 332-1988|Hotty 978-LOVE"
; read in data from a file?
Global $Key[10], $Symbol[10] = ["", "", "@", "%", "?", "!", ".", "+", "-", "="]
$Key[2] = "A,B,C,a,b,c"
$Key[3] = "D,E,F,d,e,f"
$Key[4] = "G,H,I,g,h,i"
$Key[5] = "J,K,L,j,k,l"
$Key[6] = "M,N,O,m,n,o"
$Key[7] = "P,Q,R,S,p,q,r,s"
$Key[8] = "T,U,V,t,u,v"
$Key[9] = "W,X,Y,Z,w,x,y,z"

$My_pic = @TempDir & "\Bckgrnd.jpg"
FileInstall(@ScriptDir & "\ipod.jpg", $My_pic)

$Main = GUICreate("T-90", 320, 480, -1, -1, $WS_POPUP)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480);, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
$exit = GUICtrlCreateLabel("", 295, 4, 20, 10)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$sound = GUICtrlCreateLabel("     OFF", 39, 3, 35, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$save = GUICtrlCreateLabel("", 267, 29, 47, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$cancel = GUICtrlCreateLabel("", 8, 29, 55, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Edit1 = GUICtrlCreateInput("~Phone #", 18, 110, 285, 53)
GUICtrlSetFont(-1, 30)
$Edit2 = GUICtrlCreateList("A Phone List", 18, 175, 285, 72)
GUICtrlSetFont(-1, 24)
GUICtrlSetData(-1, $Info_Read, 1)
$B[1] = GUICtrlCreateLabel(" Clear", 0, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[2] = GUICtrlCreateLabel(" @", 107, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[3] = GUICtrlCreateLabel(" %", 214, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[4] = GUICtrlCreateLabel(" ?", 0, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[5] = GUICtrlCreateLabel(" !", 107, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[6] = GUICtrlCreateLabel(" .", 214, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[7] = GUICtrlCreateLabel(" +", 0, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[8] = GUICtrlCreateLabel(" -", 107, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[9] = GUICtrlCreateLabel(" =", 214, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$star = GUICtrlCreateLabel(" Numbers", 0, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[0] = GUICtrlCreateLabel(" Space", 107, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$del = GUICtrlCreateLabel("", 214, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_GuiRoundCorners($Main, 1, 1, 10, 10)
GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $exit, -3
            Exit
        Case $save, $cancel
            MsgBox(0X0, "Sorry", "This action is not currently available.... 8)    ")
        Case $star
            If GUICtrlRead($star) = " Numbers" Then
                $action = " Letters"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Letters")
            ElseIf GUICtrlRead($star) = " Letters" Then
                $action = " Symbols"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Symbols")
            Else
                $action = " Numbers"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Numbers")
            EndIf
        Case $del
            GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
            If $Voice Then Speak_Now("BackSpace")
            While GUIGetMsg() = $del
                GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
                If $Voice Then Speak_Now("BackSpace")
                Sleep(10)
            WEnd
        Case $sound
            If StringInStr(GUICtrlRead($sound), "ON") Then
                $Voice = 0
                GUICtrlSetData($sound, "     OFF")
            Else
                $Voice = 1
                GUICtrlSetData($sound, "     ON")
                If $Voice Then Speak_Now("Voice, On")
            EndIf
            
        Case Else
            For $x = 0 To 9
                If $msg = $B[$x] Then
                    Set_Text($x)
                    ;ExitLoop
                EndIf
            Next
    EndSwitch
    
WEnd

Func Set_Text($in)
    $Info = GUICtrlRead($Edit1)
    If StringInStr($Info, "~") Then $Info = ""
    If $action = " Numbers" Then
        If $Voice Then Speak_Now($in)
        Return GUICtrlSetData($Edit1, $Info & $in)
    EndIf
    If $in = "1" Then
        If $Voice Then Speak_Now("Clear")
        Return GUICtrlSetData($Edit1, "")
    EndIf
    If $in = "0" Then
        If $Voice Then Speak_Now("Space")
        Return GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & " ")
    EndIf
    If $action = " Symbols" Then
        If $Voice Then Speak_Now("Symbol")
        Return GUICtrlSetData($Edit1, $Info & $Symbol[$in])
    EndIf
    Local $lock = GUIGetCursorInfo($Main), $Split = StringSplit($Key[$in], ","), $cnt = 1
    GUICtrlSetData($Edit1, $Info & $Split[$cnt])
    If $Voice Then Speak_Now($Split[$cnt])
    While IsArray($lock) And $lock[4] == $B[$in]
        Sleep(100)
        $lock = GUIGetCursorInfo($Main)
        If IsArray($lock) And $lock[2] = "1" Then
            $cnt += 1
            $Info = StringTrimRight(GUICtrlRead($Edit1), 1)
            GUICtrlSetData($Edit1, $Info & $Split[$cnt])
            If $Voice Then Speak_Now($Split[$cnt])
            If $cnt >= $Split[0] Then $cnt = 0
            Sleep(100)
        EndIf
        Sleep(100)
    WEnd
EndFunc   ;==>Set_Text

Func Speak_Now($Now_text)
    Local $oi_speech = ObjCreate("SAPI.SpVoice")
    If IsObj($oi_speech) Then $oi_speech.Speak($Now_text)
    $oi_speech = ""
EndFunc   ;==>Speak_Now

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ; thanks gafrost
    Dim $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
        $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
EndFunc   ;==>_GuiRoundCorners

Hope that helps!!!

8)

NEWHeader1.png

Link to comment
Share on other sites

Valuater thank you again,

yes i notice the voice, noe i'm studing to finf script where use

can select from windows installed sapi voices.

from what i've read default system voice is taken from script to speak,

but un Vista can't works (?). If only user can choise...

Also study your script to implement 'my' T9 vocabularies work,

Very elegant script, thank you!

m.

Link to comment
Share on other sites

  • 4 weeks later...

Thanks, nice work! :)

Have you considered something that could automatically convert an existing au3 to xskin.

Or an au3 that's already xskined to a new skin?

Now that would kick a** :)

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

I think it would be very difficult to make one for XSkin, however JScript had made one for EzSkin and when he left he had all of his posts deleted.

I am thinking of making one for EzSkin, but not to the level that JScript did....

Better than that, there were quit a few who had downloaded the EzSkin coverter from JScript and might still have a working copy that they can post it

8)

NEWHeader1.png

Link to comment
Share on other sites

hmm wish I had a copy for you.

But in any case, again very nice work :)

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

  • 3 weeks later...

Thanks Ken...

thx u very much Valuater! Honesty, i used Xskin to skin my GUI but i don't know how to skin the button with Xskin so had mixed Ez + X, but now i can skin my gui with only Xskin. Once again thanks for your helps!

That is what I thoought you were doing...

Your Welcome ... LeHuynhNam

8)

NEWHeader1.png

Link to comment
Share on other sites

and i have more some question!

i have this code:

#include <GuiConstants.au3>
Opt("GUIResizeMode", $GUI_DOCKALL)
$Gui = GuiCreate("Test", 300, 200)
$Expand_Button = GUICtrlCreateButton("Expand", 20, 80, 80)
$Button1 = GUICtrlCreateButton("Some Button", 20, 240, 80)
$Button2 = GUICtrlCreateButton("Other Button", 120, 240, 80)
$Input = GUICtrlCreateInput("Some Input", 20, 210, 200, 20)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $Expand_Button
            Local $Height, $ButtonText
            $GuiPos = WinGetPos($Gui)
            If $GuiPos[3] < 320 Then
                $Height = 320
                $ButtonText = "Hide"
            Else
                $Height = 225
                $ButtonText = "Expand"
            EndIf
            GUICtrlSetData($Expand_Button, $ButtonText)
            WinMove($Gui, "", $GuiPos[0], $GuiPos[1], $GuiPos[2], $Height)
    EndSwitch
WEnd

and i want to skin it! but when i click the Expand button the gui change with fragmentative skin! Can u update new function to resolve this problem! i mean i can use winmove with my gui without changing the skin...

sorry 4 my bad english! :)

4m848p10.gif 

Link to comment
Share on other sites

i've tried it with ezskin and Xskin but it still no tooltip!

This works for XSKIN... You told me you are now using XSkin in previous posts

( not tested on EzSkin)

#include <XSkin.au3>

; folder of skin
$Skin_Folder = @ScriptDir & "\Skins\Black-Yellow"

$XSkinGui = XSkinGUICreate( "My GUI", 400, 450, $Skin_Folder)

$button_1 = XSkinButton("Button 1", 145, 100, 100, 35, "Hello")

if IsArray($button_1) Then MsgBox(0,0,0)

; use this....$CtrlButton[ BUTTON NAME HERE][0]
GUICtrlSetTip($CtrlButton[$button_1][0] , "This is a Control Tip   ") 

GUISetState()

While 1
   
    MouseOver()
   
    Sleep(10)
WEnd

Func Hello()
    MsgBox(64, "XSkin", "Test Button 1", 3)
EndFunc

BTW... neither EzSkin nor XSkin can have the GUI change size, it must be re-created

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

thx valuater! i use your code to set tip for my button which created by _HoverButton

GUICtrlSetTip($CtrlButton[$button_1][0] , "This is a Control Tip   ")

and it appeared error

C:\Documents and Settings\ANHNAM\My Documents\Compressed\XSkin_Fully_Loaded\a.au3 (17) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
GUICtrlSetTip($CtrlButton[$button_1][0] , "This is a Control Tip   ")
GUICtrlSetTip(^ ERROR

what should i do?

4m848p10.gif 

Link to comment
Share on other sites

..bump... I have question! i used _hoverbutton to created my button and how can i set tip for it?

Like This... ( Standard Autoit use )

This is a _ButtonHover() Demo ... NOT XSkin

#include <_ButtonHover.au3>
#include <File.au3>

; required
; $XButton_Location = @ScriptDir & "\Buttons\Style_1"

$XButton_Location = FileReadLine(@ScriptDir & "\Buttons\BDefault.txt", 1)
If Not FileExists($XButton_Location) Then $XButton_Location = FileSelectFolder("Button Folders", @ScriptDir & "\Buttons", 2)

$color = ""
If StringInStr($XButton_Location, "15") Then $color = 0xFFFFFF

$Main_GUI = GUICreate("_ButtonHover Demo")
$List = GUICtrlCreateList("", 40, 80, 100, 100)
GUICtrlCreateLabel($XButton_Location, 20, 20, 400, 20)

$Button_1 = _HoverButton ("Small", 180, 80, 70, 15, $color)
GUICtrlSetTip( $Button_1, "This is a control tip for #1  ")
$Button_2 = _HoverButton ("Medium", 180, 120, 90, 30, $color)
GUICtrlSetTip( $Button_2, "This is a control tip  for #2")
$Button_3 = _HoverButton ("Long", 180, 180, 190, 30, $color)
GUICtrlSetTip( $Button_3, "This is a control tip  for #3")
$Button_4 = _HoverButton ("Large", 180, 240, 190, 60, $color)
GUICtrlSetTip( $Button_4, "This is a control tip  for #4")
$Button_5 = GUICtrlCreateButton("Select", 50, 200, 80, 25)
GUICtrlSetTip($Button_5, "Select a Button Style")
GUISetState()

$FileList = _FileListToArray(@ScriptDir & "\Buttons", "*.*", 2)
If (Not IsArray($FileList)) Or (@error = 1) Then
    MsgBox(0, "", "No Files\Folders Found.", 5)
Else
    For $x = 1 To UBound($FileList) - 1
        If StringInStr($FileList[$x], "more") Then ContinueLoop
        $result = StringInStr($FileList[$x], "\", 1, -1)
        $final = StringTrimRight($FileList[$x], $result)
        GUICtrlSetData($List, $final, 1)
    Next
EndIf


While 1
    ; required
    _CheckHoverAndPressed ($Main_GUI)

    $msg = GUIGetMsg()
    Select
       
        Case $msg = $Button_1
            MsgBox(64, "test", " You pressed Small   ", 3)
        Case $msg = $Button_2
            MsgBox(64, "test", " You pressed Medium- long   ", 3)
        Case $msg = $Button_3
            MsgBox(64, "test", " You pressed Long   ", 3)
        Case $msg = $Button_4
            MsgBox(64, "test", " You pressed Large   ", 3)
        Case $msg = $Button_5
            Buttoner()
        Case $msg = -3
            Exit
       
    EndSelect

WEnd

Func Buttoner()
    $New_Btn = GUICtrlRead($List)
    If $New_Btn = "" Then Return
    FileDelete(@ScriptDir & "\Buttons\BDefault.txt")
    FileWrite(@ScriptDir & "\Buttons\BDefault.txt", @ScriptDir & "\Buttons\" & $New_Btn)
    Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    Exit
EndFunc   ;==>Buttoner

8)

NEWHeader1.png

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