Jump to content

GUI Design?


dufran3
 Share

Recommended Posts

This will do the trick

#include <GUIConstants.au3>
#include <_ButtonHover.au3>
#include <GuiTab.au3>


Opt("GUIOnEventMode", 1)        ;0=disabled, 1=OnEvent mode enabled

$Form2 = GUICreate("", 330, 400, 120, 100)

$tab = GUICtrlCreateTab(10, 10, 300, 100)

$tab0 = GUICtrlCreateTabItem("tab #0")
GUICtrlCreateLabel("label 0", 30, 80, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab #1")
GUICtrlCreateLabel("label 1", 30, 80, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab #2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label 2", 30, 80, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$progselect = GUICtrlCreateButton('Select Tab', 130, 300, 75, 25)
GUICtrlSetOnEvent($progselect, '_SelectAll')

$Status = GUICtrlCreateLabel("", 10, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetOnEvent($GUI_EVENT_CLOSE, "exiter", $Form2)
GUISetState()

While 1
    Sleep(10)
WEnd

Func _SelectAll()
    $current = _GUICtrlTabGetCurFocus($tab)
    GUICtrlSetData($Status, "Items Current Focus: " & $current)
    
    Switch $current
        Case 0
            MsgBox(0x0, "Tab 0", "tab O was chosen", 2)
        Case 1
            MsgBox(0x0, "Tab 1", "tab 1 was chosen", 2)
        Case 2
            MsgBox(0x0, "Tab 2", "tab 2 was chosen", 2)
    EndSwitch

EndFunc   ;==>_SelectAll



Func exiter()
    Exit
EndFunc   ;==>exiter

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Replies 111
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Works fantastic on each tab, clicking the button launches the message that says which tab I am on, I am having issues with one of the lines. The line below. It is creating a white bar across the body of the GUI under each tab. The height of this line is about the size of a input box. I am putting this line in after I declare all my tabs and tab items. I added the code "GUICtrlCreateTabItem("") after the last tab, to see if that would fix it. Not sure what I did wrong to get that line there.

$Status = GUICtrlCreateLabel("", 10, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

When I click the button, the white box has text in it "Items Current Focus: 0" or 1 or 2 or 3 depending on what tab is open when clicking the button. Hope that helps.

Can I take all this back???

I now realize that it was just cosmetic, to help me see what was going on. I was able to comment out 2 lines, the $status line, and the line in the function. I'm dumb, sorry

Edited by dufran3
Link to comment
Share on other sites

Works fantastic on each tab, clicking the button launches the message that says which tab I am on, I am having issues with one of the lines. The line below. It is creating a white bar across the body of the GUI under each tab. The height of this line is about the size of a input box. I am putting this line in after I declare all my tabs and tab items. I added the code "GUICtrlCreateTabItem("") after the last tab, to see if that would fix it. Not sure what I did wrong to get that line there.

$Status = GUICtrlCreateLabel("", 10, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

When I click the button, the white box has text in it "Items Current Focus: 0" or 1 or 2 or 3 depending on what tab is open when clicking the button. Hope that helps.

Can I take all this back???

I now realize that it was just cosmetic, to help me see what was going on. I was able to comment out 2 lines, the $status line, and the line in the function. I'm dumb, sorry

You might have been seeing the white bar because you didn't set a background color to the label and could be the default. It's happened to me before and depending on the style of your OS theme you might not notice it until your on another computer. Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

Ok, I know you hate me, but I have another question about _hoverbutton. I got it to work, everything working fine, I'm just trying to tweak everything to fit my needs. As it works right now, you have 3 buttons. Normal, over, and pressed. So if I say this:

;Create Buttons
$install = _HoverButton("Install", 280, 265, 75, 25)
GUICtrlSetOnEvent($install, 'Install')
$select = _HoverButton('Select All', 280, 310, 75, 25)
GUICtrlSetOnEvent($Clinicalselect, '_SelectAll')
$deselect = _HoverButton('Deselect All', 280, 355, 75, 25)
GUICtrlSetOnEvent($Clinicaldeselect, '_DeselectAll')
$Exit = _HoverButton('Exit', 280, 400, 75, 25)
GUICtrlSetOnEvent($Exit, 'Exitier')

It will have the Normal button 4 times. All with the appropriate label, "install" "Select All" "Deselect All" and "Exit". Is it possible to use a seperate "normal, over and pressed" image for each of those items?

Link to comment
Share on other sites

Ok, I know you hate me, but I have another question about _hoverbutton. I got it to work, everything working fine, I'm just trying to tweak everything to fit my needs. As it works right now, you have 3 buttons. Normal, over, and pressed. So if I say this:

;Create Buttons
$install = _HoverButton("Install", 280, 265, 75, 25)
GUICtrlSetOnEvent($install, 'Install')
$select = _HoverButton('Select All', 280, 310, 75, 25)
GUICtrlSetOnEvent($Clinicalselect, '_SelectAll')
$deselect = _HoverButton('Deselect All', 280, 355, 75, 25)
GUICtrlSetOnEvent($Clinicaldeselect, '_DeselectAll')
$Exit = _HoverButton('Exit', 280, 400, 75, 25)
GUICtrlSetOnEvent($Exit, 'Exitier')

It will have the Normal button 4 times. All with the appropriate label, "install" "Select All" "Deselect All" and "Exit". Is it possible to use a seperate "normal, over and pressed" image for each of those items?

Yea your right.. I do hate you... LOL

_ButtonHover() was designed to use "button themes", But...

_ControlHover() was designed to use each control individually, and there are a couple of button demos in that UDF thread

( click great programs below )

8)

NEWHeader1.png

Link to comment
Share on other sites

I'm looking at that function _ControlHover(). I don't see where you set images on that. I'm not sure how to use this function. I tried looking in the _ButtonHover include, but couldn't find anywhere that set different images. By the way....here is where my GUI is at thus far: As you can see, I made a custom image that said "start" in photoshop. Not thinking that it was going to use that image for each button. Can you help? I'm not sure how to use this _controlHover. I really appreciate all your help.

Posted Image

Link to comment
Share on other sites

I tried adding in the ControlHover to test it. And my pc whirs up, and just sits there churning. An icon still in the system tray, but no GUI ever displays. Not sure if it is stuck in the While/WEnd loop. here is what I added to my script.

;Control Hover Testing
        $ButtonLocation = '\\fs1\is stuff\newpc\Automated Installs\files\xSkin\testing\Xbutton\HoverButton\'
        $ClinInstall = GUICtrlCreatePic($ButtonLocation & 'install_normal.jpg',280,180,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $ClinSelect = GUICtrlCreatePic($ButtonLocation & 'select_normal.jpg',280,220,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
    #cs
        WinSetTrans($Main, "", 0)
        GUISetState(@SW_SHOW)
        If @OSVersion <> "WIN_NT4" And @OSVersion <> "WIN_ME" And @OSVersion <> "WIN_98" And @OSVersion <> "WIN_95" And @OSVersion <> "WIN_6.0" And @OSVersion <> "WIN_6.1" Then
            For $transcount = 0 To 255 Step 17
                WinSetTrans($Main, "", $transcount)
                Sleep(11)
            Next
        EndIf
    #CE
        
        _ControlHover(2, "", $ClinInstall)
        _ControlHover(2, "", $ClinSelect)
        
    While 1
        AutoItSetOption("MouseCoordMode",0)
        $pos = MouseGetPos()
        $1 = ControlGetPos($Main,"", $ClinInstall)
        $nMsg = GUIGetMsg()
        If $nMsg = $GUI_EVENT_CLOSE Then
            ;If @OSVersion <> "WIN_NT4" And @OSVersion <> "WIN_ME" And @OSVersion <> "WIN_98" And @OSVersion <> "WIN_95" And @OSVersion <> "WIN_6.0" And @OSVersion <> "WIN_6.1" Then
            ;   For $transcount = 255 To 0 Step -17
            ;       WinSetTrans($Main, "", $transcount)
            ;       Sleep(11)
            ;   Next
            ;EndIf
            Exit
        EndIf
        $Over = _ControlHover(0, $Main)
        If $Over = 1 Then
            $tempID = @extended
            If $tempID = $ClinSelect Then
                GUICtrlSetImage($ClinSelect,$ButtonLocation & 'select_normal.jpg')
            Else
                GUICtrlSetimage($ClinSelect,$ButtonLocation & 'select_over.jpg')
            EndIf
            If $tempID = $ClinInstall Then
                GUICtrlSetImage($ClinInstall,$ButtonLocation & 'install_normal.jpg')
            Else
                GUICtrlSetimage($ClinInstall,$ButtonLocation & 'install_over.jpg')
            EndIf
        EndIf
        $Click = _ControlHover(1, $Main)
        If $Click = 1 And @extended = $ClinInstall Then
            GUICtrlSetImage($ClinInstall,$ButtonLocation & 'install_press.jpg')
            ToolTip("You Clicked Left Button", 10, 10, "ToolTip", 1)
            Sleep(138)
            If $tempID = $ClinInstall Then
                GUICtrlSetImage($ClinInstall,$ButtonLocation & 'install_normal.jpg')
            Else
                GUICtrlSetimage($ClinInstall,$ButtonLocation & 'install_over.jpg')
            EndIf
        EndIf
        If $Click = 1 And @extended = $ClinSelect Then
            GUICtrlSetImage($ClinSelect,$ButtonLocation & 'select_press.jpg')
            ToolTip("You Clicked Right Button", 10, 10, "ToolTip", 1)
            Sleep(138)
            If $tempID = $ClinSelect Then
                GUICtrlSetImage($ClinSelect,$ButtonLocation & 'select_normal.jpg')
            Else
                GUICtrlSetimage($ClinSelect,$ButtonLocation & 'select_over.jpg')
            EndIf
        EndIf
    WEnd
Link to comment
Share on other sites

I added

GUISetState(@SW_Show)

and the gui appeared, and the 2 images appeared to work. But it broke the hell out of my GUI. Only one of the tabs showed up...none of the other ButtonHover Buttons. yeh...maybe this isn't going to work the way I wanted....:-(

Well...I had the While loop in side of where I was creating the buttons on the first tab. So I moved the entire while loop down by the function declaration section, outside of the tab.

The only thing that is in the first tab for this is this:

;Control Hover Testing
        $ButtonLocation = '\\fs1\is stuff\newpc\Automated Installs\files\xSkin\testing\Xbutton\HoverButton\'
        $ClinInstall = GUICtrlCreatePic($ButtonLocation & 'install_normal.jpg',280,180,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $ClinSelect = GUICtrlCreatePic($ButtonLocation & 'select_normal.jpg',280,220,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        
        _ControlHover(2, "", $ClinInstall)
        _ControlHover(2, "", $ClinSelect)

It seems to....kind of work. The loop seems slow, and the hover images get screwed up when the mouse is not inside of the GUI window....

Another edit. I see what happens. If I move the mouse over 1 button, the hover image appears, If I move my mouse over the next button, the hover goes away on the first, and shows up on the second image. However, If I move the mouse over image 1, hover appears, then move the mouse somewhere else in the GUI, not on a button, the hover image still shows on the button.

Edited by dufran3
Link to comment
Share on other sites

I have this code on 4 different tabs. It only works on the last tab I have the code on...If I only put it on tab 1, works fine, if I have it on tab 1 and 2, only 2 shows mouseover and click effects.

;Create Buttons
        $ButtonLocation = '\\fs1\is stuff\newpc\Automated Installs\files\xSkin\testing\Xbutton\HoverButton\'
        $Start = GUICtrlCreatePic($ButtonLocation & 'start_normal.jpg',280,265,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Select = GUICtrlCreatePic($ButtonLocation & 'select_normal.jpg',280,310,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Deselect = GUICtrlCreatePic($ButtonLocation & 'deselect_normal.jpg',280,355,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Exit = GUICtrlCreatePic($ButtonLocation & 'exit_normal.jpg',280,400,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        
        _ControlHover(2, "", $Start)
        _ControlHover(2, "", $Select)
        _ControlHover(2, "", $Deselect)
        _ControlHover(2, "", $Exit)
Link to comment
Share on other sites

JUst Guessing again....

#1

_ButtonHover() UDF, has _ControlHover() built into it....

there was no problem/error with "duplicate function name" ?????

#2

are you sure you are adding all the button names for each tab.....AND... the button names are different???

8)

NEWHeader1.png

Link to comment
Share on other sites

no duplicated function name. I saw that _ButtonHover had _controlHover in it, so I didn't include the seperate _ControlHover UDF. I changed the path's of all my file locations, and put them all at @ScriptDir, and PM'd you. You should be able to open RDT1.2.au3, the other files are includes. That is the main file. Can you take a peek at it for me....again....I would really appreciate any advice that you could throw my way.

Link to comment
Share on other sites

Just like I guessed... Why did you not find this "after" i suggested it could be the problem

from #2 above

;Control Hover Testing - line 221 to 231
        $ButtonLocation = @ScriptDir & '\HoverButton\'
        $Start = GUICtrlCreatePic($ButtonLocation & 'start_normal.jpg',280,265,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Select = GUICtrlCreatePic($ButtonLocation & 'select_normal.jpg',280,310,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Deselect = GUICtrlCreatePic($ButtonLocation & 'deselect_normal.jpg',280,355,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        $Exit = GUICtrlCreatePic($ButtonLocation & 'exit_normal.jpg',280,400,75,25, BitOR($SS_NOTIFY,$WS_GROUP))
        
        _ControlHover(2, "", $Start)
        _ControlHover(2, "", $Select)
        _ControlHover(2, "", $Deselect)
        _ControlHover(2, "", $Exit)

oÝ÷ ٩ݶ§¶,yªÞz¶¬yÖÞq«¬{*.v'm+ºÚ"µÍÐÜX]H]ÛÈH[HÌÈÈÌÌ  ÌÍÐ]ÛØØ][ÛHØÜ  [È ÌÎNÉÌLÒÝ]ÛÌLÉÌÎN   ÌÍÔÝHÕRPÝÜX]TXÊ ÌÍÐ]ÛØØ][Û   [È ÌÎNÜÝÛÜX[ÉÌÎNËK
ÍKK]Ô ÌÍÔÔ×ÓÕQK    ÌÍÕÔ×ÑÔÕT
JB  ÌÍÔÙ[XÝHÕRPÝÜX]TXÊ ÌÍÐ]ÛØØ][Û   [È ÌÎNÜÙ[XÝÛÜX[ÉÌÎNËÌL
ÍKK]Ô ÌÍÔÔ×ÓÕQK    ÌÍÕÔ×ÑÔÕT
JB  ÌÍÑÙ[XÝHÕRPÝÜX]TXÊ ÌÍÐ]ÛØØ][Û   [È ÌÎNÙÙ[XÝÛÜX[ÉÌÎNËÍMK
ÍKK]Ô ÌÍÔÔ×ÓÕQK    ÌÍÕÔ×ÑÔÕT
JB  ÌÍÑ^]HÕRPÝÜX]TXÊ ÌÍÐ]ÛØØ][Û   [È ÌÎNÙ^]ÛÜX[ÉÌÎNË

ÍKK]Ô ÌÍÔÔ×ÓÕQK    ÌÍÕÔ×ÑÔÕT
JBÐÛÛÛÝ    ][ÝÉ][ÝË    ÌÍÔÝ
BÐÛÛÛÝ ][ÝÉ][ÝË    ÌÍÔÙ[XÝ
BÐÛÛÛÝ ][ÝÉ][ÝË    ÌÍÑÙ[XÝ
BÐÛÛÛÝ ][ÝÉ][ÝË    ÌÍÑ^]
B

I wont run your script due to registry entries

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

lol, yeh...sorry, registry entries....I will not pwn your computer, but you don't really know me. It's cool man! Thx for the help. I am such a n00b. I figured they could be the same because....i don't really know my logic behind that one...

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