Jump to content
BBs19

MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.

Recommended Posts

BBs19
 

Very cool.

Can you provide example with Edit ?

 

btw.
please post it here:
https://www.autoitscript.com/forum/files/category/11-gui-additions/

What do you mean with edit? Normal GUICtrlCreateEdit?

GUICtrlCreateEdit("",20,200,200,100,-1,0); This makes it look flat as it removes the borders. I am not sure how it looks on Windows 7 though.

Ps.: I will post it there.

 

When running the example, no text shows on the buttons. Changing theme/text color does nothing; neither does running in Beta (although beta-run makes buttons fit into the GUI better)

 

Am I missing something?

Please try chaning the font to Arial or something. Maybe you don't have Callibri Light on your computer, that is the default font. Try: 

$Button1 = _Metro_CreateButton($GUI_HOVER_REG, "Button Style 1", 105, 250, 130, 40, $ButtonBKColor,  $ButtonTextColor, "Arial", 11)

Ps. Can you tell me on which Windows you are?

 

Its good but my only comment would be i cant make the check boxes or radio buttons smaller than 24 the slider and buttons etc are great but the check and radios seem out of proportion with the others

Now that you say it, i see it, too :P You can change it now for the radio:  

$Radio1 = _Metro_CreateRadio($GUI_HOVER_REG, 1, "Radio 1", 180, 70, 100, 26,$GUIThemeColor, $FontThemeColor, "Segoe UI", "11",  0, 22) ;< Last parameter tells the size for the circle.

For checkboxes it is a little harder, i am not sure how to calculate it so that the checkmark of the checkboxe doesn't gets deformated or misplaced using GDIPlus. I just started learning GDIPlus and I was never good at math :P I have just reduced it to 22px. UDF Updated in first post.

 

Share this post


Link to post
Share on other sites
Inpho

Ah thankyou, all working perfectly now. Had to download Calibri Light (available for free from thefonty.com)

I'm using Win7 Pro x64

Share this post


Link to post
Share on other sites
rcmaehl

Think switch block in main while loop can be easily shortened.

Switch $nMsg
    Case $GUI_EVENT_CLOSE, $ExitButton
        _WinAPI_DeleteObject($aExitButton[0])
        _WinAPI_DeleteObject($aExitButton[1])
        _WinAPI_DeleteObject($aMinimizeButton[0])
        _WinAPI_DeleteObject($aMinimizeButton[1])
        _WinAPI_DeleteObject($aButton2[0])
        _WinAPI_DeleteObject($aButton2[1])
        _WinAPI_DeleteObject($aButton1[0])
        _WinAPI_DeleteObject($aButton1[1])
        _GDIPlus_Shutdown()
        Exit
    Case $MinimizeButton
        GUISetState(@SW_MINIMIZE, $Form1)

    Case $Button1
        MsgBox(64, "", "Button 1")
    Case $Button2
        MsgBox(64, "", "Button 2")
EndSwitch

Why not

Switch $nMsg
    Case $GUI_EVENT_CLOSE, $ExitButton
        For $l = 0 To 1 Step 1
            _WinAPI_DeleteObject($aExitButton[$l])
            _WinAPI_DeleteObject($aMinimizeButton[$l])
            _WinAPI_DeleteObject($aButton2[$l])
            _WinAPI_DeleteObject($aButton1[$l])
        Next
        _GDIPlus_Shutdown()
        Exit
    Case $MinimizeButton
        GUISetState(@SW_MINIMIZE, $Form1)

    Case $Button1
        MsgBox(64, "", "Button 1")
    Case $Button2
        MsgBox(64, "", "Button 2")
EndSwitch

 


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
BBs19

Why not

Switch $nMsg
    Case $GUI_EVENT_CLOSE, $ExitButton
        For $l = 0 To 1 Step 1
            _WinAPI_DeleteObject($aExitButton[$l])
            _WinAPI_DeleteObject($aMinimizeButton[$l])
            _WinAPI_DeleteObject($aButton2[$l])
            _WinAPI_DeleteObject($aButton1[$l])
        Next
        _GDIPlus_Shutdown()
        Exit
    Case $MinimizeButton
        GUISetState(@SW_MINIMIZE, $Form1)

    Case $Button1
        MsgBox(64, "", "Button 1")
    Case $Button2
        MsgBox(64, "", "Button 2")
EndSwitch

 

That was the very old code, but yes could have been also done that way. :)

It is all in a seperate function now, i tried to make it as efficient as possible now.

Share this post


Link to post
Share on other sites
Rnde

Looks good but button text doesn't show.

I'm on Windows 7 Pro x64.

examp.png

Share this post


Link to post
Share on other sites
matej203

Yes, that's problem on Windows 7, Buttons text doesn't show. It works perfect on Windows 8, 8.1 and 10

Share this post


Link to post
Share on other sites
kyo

Windows 7 Pro x64 here, and there is text on the buttons...

Untitled_cr.thumb.jpg.b0ad873a8d93dd7f97

Share this post


Link to post
Share on other sites
matej203

How is that possible? I treid it on virtual machine Windows 7 x86 and it's not working... :(

Share this post


Link to post
Share on other sites
BBs19

Looks good but button text doesn't show.

I'm on Windows 7 Pro x64.

examp.png

I don't know why there is no Calibri Light font on some Windows 7. Maybe you don't have all updates?

Try using other fonts like Arial or Segoe UI or something like that. I wouldn't use normal Calibri as it somehow doesn't have antialiasing when using GDIPlus.

 

Try:

$Button1 = _Metro_CreateButton($GUI_HOVER_REG, "Button Style 1", 105, 250, 130, 40, $ButtonBKColor,  $ButtonTextColor, "Arial", 11)

Share this post


Link to post
Share on other sites
Rnde

I don't know why there is no Calibri Light font on some Windows 7. Maybe you don't have all updates?

Try using other fonts like Arial or Segoe UI or something like that. I wouldn't use normal Calibri as it somehow doesn't have antialiasing when using GDIPlus.

 

Try:

$Button1 = _Metro_CreateButton($GUI_HOVER_REG, "Button Style 1", 105, 250, 130, 40, $ButtonBKColor,  $ButtonTextColor, "Arial", 11)

Yep looks like this is the case, didn't have the font installed. Problem fixed.

Share this post


Link to post
Share on other sites
legend

I've found a bug with:

_Metro_MsgBox

 

Try create a variable with this sample: $mc = "C:\Users\steen\Desktop\Custom-Icon-Design-Flatastic-11-At.ico"

and use it with _Metro_MsgBox, like: _Metro_MsgBox("Metro MsgBox Example", "You have selected a new icon:" & @CRLF & @CRLF & $mc, 350, 14, $Form1)

nvm, just delete this post, if i remove 350 and 14, then it works fine

It will crash

Edited by legend

Share this post


Link to post
Share on other sites
skynetparkie

Please education for a new GUI from scratch, you can record video when you set an example to us + design also can be done in this gui design Is kodadesing program? Please share the video you ;)

Share this post


Link to post
Share on other sites
BBs19

Please education for a new GUI from scratch, you can record video when you set an example to us + design also can be done in this gui design Is kodadesing program? Please share the video you ;)

Hmm.. I usually just create the GUI in Koda, then add the few lines required for UDF(you can use the example), replace the GUICreate, Buttons etc. with the with the metro udf functions by just replacing all. That is it :) It is mostly copy, paste and replace.

Share this post


Link to post
Share on other sites
legend

can you show an example of how to have multiple gui windows, so if you click a button,

it will create a new gui, and when you X it, then it removes the GUI again.

I tried that, but it will make the orginal gui stock, and not able to be moved

Share this post


Link to post
Share on other sites
lampel

how can i add a text edit control (GUICtrlCreateEdit) ???

 

thanks lampel

Share this post


Link to post
Share on other sites
legend

Is it really not possible to change the state of a radiobox, but only a toggle and a checkbox,

why would there even be a radiobox in the udf, if you can't check if it's selected or not 0_o

http://prntscr.com/ad909v

Edited by legend

Share this post


Link to post
Share on other sites
nuhan

hi,

i want to use  MetroGUI UDF v3  in my script. I need help to create a message box using  _Metro_MsgBox. but in metro udf MsgBox  contains only one button i need two button in my message box. And also i have to run some code if user click on each button in msgbox. Please help me.

 

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

  • Similar Content

    • PramodR
      By PramodR
      Hello,
      I have to execute below block of code in elevated previllage, as that particular wmic class will work only with admin previlage.
      i am getting out put when i launch autoit as administrator,  but i will not be able to launch autoit as admin in this particular case but my user have admin rights.
      is there any better way i can run those command as administrator.?
      tried below steps:
      i have tried #RequireAdmin but that creates a user prompt  Tried using Runas command but gives error as wrong username or password , stuck with that step.  
       
    • dwaynek
      By dwaynek
      traytip isn't working in windows 10. nothing happens when i use the Traytip command.
      here's a simple script i used:
      TrayTip("I'm a title", "I'm the message", 5) i tried changing the registry setting HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced ( which didn't have EnableBalloonTips) and creating a DWORD entry called EnableBalloonTips and setting it to 1 and logging off then back in. that did not resolve the problem.
      i'm running Windows 10 v1709 b16299.431
    • antonioj84
      By antonioj84
      Hi all to the forum guru and expert I am trying to  automate this. in the registry  I have the network profile name network 2 and network   I want to  change their  CATEGORY  to Private .  Can someone lead me in the right direction.
      Private is 1 and Public is 0
      #RequireAdmin Global $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM" RegWrite($sHKLMRoot &"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" ,'/v NetworkList /t REG_MULTI_SZ /d 00000000 /f') see  attached picture below
      Much appreaciate
       

    • PhoenixPRO
      By PhoenixPRO
      When I try to automate this install program I can not get any of the buttons to click with the "ControlClick" function or any mouse movement to move the mouse to the and click it.  My OS is Windows 10 64Bit.  I have tried both 32bit and 64bit installs of Autoit V3 to no avail.
      I could not even get the run command to start the program until I used the variation of the command below in the script.
      With the script below the install program starts but will not click the "Next" button no matter what I do.
      Any help will be greatly appreciated.
      Thanks in advance.
       
      #include <MsgBoxConstants.au3>
      Opt("MouseCoordMode", 0) ;1=absolute, 0=relative to active window, 2=client
      Local $Success
      Run(@ComSpec & " /c " & 'C:\PhoenixPro_Install\RDXUtil\RDX_Tools_setup.exe', "C:\PhoenixPro_Install\RDXUtil", @SW_HIDE )

      WinWait("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      WinActivate("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      ControlClick ("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62", 1639, "left", 1) ;Next Button
    • TheWizEd
      By TheWizEd
      How do I work with 2D arrays.  I've tried this but get errors.
      Local $aTest[4][4] = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
      ;$aTest[0][] = [10,11,12]  ; Error at []
      Local $sTest = ""
      For $i = 0 To UBound($aTest)-1
        Local $aExtract = _ArrayExtract($aTest,$i,$i)
        $sTest = $sTest & MyTest($aExtract)
      Next
      Func MyTest($aTemp)
        _ArrayDisplay($aTemp)
        ; Error at    v $aTemp
        Return String($aTemp[0]) & " - " & String($aTemp[1]) & " - " & String($aTemp[2]) & @CRLF
      EndFunc
       
       
×