BBs19

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

198 posts in this topic

 

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



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

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


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

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

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

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

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

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

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

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

#33 ·  Posted (edited)

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

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

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

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

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

 

thanks lampel

Share this post


Link to post
Share on other sites

#38 ·  Posted (edited)

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

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

    • davidacrozier
      By davidacrozier
      Hello all ~
      I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2.  Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc.  Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully.  The desktop, documents, USB external all open without issue.  The network share opening gives me issues.  Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead.  I understand that the documents folder is the default for explorer.  I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result.  When I run this script on Windows 10 alone without  the VM or the ESXi I am able to open the network share without problems.  I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script.  This did not work for me.  
      One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share.  Once found,  double click on it and see if that opens the shared network folder.  I can click inside the VM with my mouse on the network share and it opens just fine.  Not sure if running up against GUI issues, or permission issues, or what?
      Thanks in advance,
      Davida Crozier
      TestNetworkShare.au3
      This script is a subset of a much larger program, but it illustrates what I am dealing with.

    • MrMajorThorburn
      By MrMajorThorburn
      Using sample code:
      #include <MsgBoxConstants.au3> ; Find a pure red pixel in the range 0,0-20,300
      Local $aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000)
      If Not @error Then
          MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
      Else
          MsgBox($MB_SYSTEMMODAL, "", "Pure Not Found")
      EndIf ; Find a pure red pixel or a red pixel within 10 shades variations of pure red
      $aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000, 10)
      If Not @error Then
          MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
      Else
          MsgBox($MB_SYSTEMMODAL, "", "Variant Not Found")
      EndIf   and the attached screenshot which has Pure Red (FF0000) in one icon in the area being searched. Would someone please check this out for me?
    • Miliardsto
      By Miliardsto
      Hello Im using Metro UDF and there is a code when menu panel is shown by clicking on menu button.
       
      And what I want I want make instead  Case $GUI_MENU_BUTTON, this $MenuSelect[1].. Case
      While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $Form1) Case $GUI_MENU_BUTTON ;Create an Array containing menu button names Local $MenuButtonsArray[5] = ["Themes Demo", "Settings", "About", "Contact", "Exit"] ; Open the metro Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_MenuStart($Form1, 150, $MenuButtonsArray) Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Starting themes demo. Please note that the window border colors are not updated during this demo." & @CRLF) ;_ThemesDemo() Case "1" ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = About button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Contact button clicked." & @CRLF) Case "4" ConsoleWrite("Returned 4 = Exit button clicked." & @CRLF) _Metro_GUIDelete($Form1) Exit EndSwitch WEnd I tried something like this what I found on forum but not work
      ;~ Case Else ;~ For $i = 0 To $MenuSelect ;~ ;MsgBox("","",$liczba) ;~ ;MsgBox("","",$MenuSelect) ;~ If $MenuSelect == "1" Then ;~ ;If $MenuSelect[$i] = "0" Then ;~ ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF) ;~ ;EndIf ;~ Elseif $MenuSelect == "2" Then ;~ ConsoleWrite("Returned 2" & @CRLF) ;~ ExitLoop ;~ EndIf ;~ Next  
    • keelaji
      By keelaji
      Hello,
      first of all i searched in the forum but i didn't found any solution to my problem.
      I am using windows 10.
      I made a script that is supposed to change the title to the active window, resize it to the smallest size possible (should be around 800 x 600) and move to (0, 0).
      I can change the title but i fail to do the other 2 tasks.
      i use wingettitle [active] copied from the F1 help tool (and this works), i i put the title in a variable and than i use
      winsettitle ($variable, "one") (this works too)
      winmove ("one", 0, 0, 800, 600) (doesn't do anything)
      i also tried
      local $x = winget ( "one")
      msgbox (0, "", $x) (i get a completely white box so i suppose winget can't have any data about my window ??)
      any suggestion ?
    • spuuunit
      By spuuunit
      I have a script that autostart with Windows, and sometimes some of my code is skipped. My script takes long pauses, so it's not that the script "goes too fast". This is my script for now:
      TraySetIcon("C:\Portables\AutoIt\_\icon.ico") AutoItSetOption("WinTitleMatchMode", 2) Run("C:\Portables\Key Manager\keymanager.exe") WinActivate("ATNSOFT Key Manager v") WinWaitActive("ATNSOFT Key Manager v") WinMove("ATNSOFT Key Manager v", "", 650, 200, 600, 800) Sleep(500) $pos = MouseGetPos() MouseClick("left", 1220, 210, 1, 100) MouseMove($pos[0], $pos[1], 100) Run("C:\Portables\foobar2000\foobar2000.exe") $version = 298 For $i = 0 To 99 Step 1 $path = "C:\Users\spunit\AppData\Local\Discord\app-0.0." & $version + $i & "\Discord.exe" If FileExists($path) Then Run($path) ExitLoop EndIf Next Run("C:\Portables\Firefox\FirefoxPortable.exe") Sleep(10000) WinMove("- Mozilla Firefox", "", 205, 0, 1214, 1047) Sleep(100) MouseClick("left", 1300, 15, 1, 10) Sleep(100) MouseClick("left", 1130, 275, 1, 10) Sleep(100) MouseClick("left", 930, 105, 1, 10) Sleep(100) Send("#{m}") Sometimes it skips to click and move mouse right after Key Manager starts. Almost always it skips everything after the last run.

      This type of script were never an issue with Windows 7... Any thoughts?