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

    • Skeletor
      By Skeletor
      Hi Virtual People, 
      I'm trying to lock my screen in Windows 10 but to no avail. 
      Has Windows 10 forbidden this feature? 
      Send("#l") Above code does not work. Even sending Ctrl Alt Del does not work nor as an Admin. 
      Note: I want to lock my screen, not log off. Thanks for been kind.
       
    • astrionn
      By astrionn
      Hi Guys,
       
      I`m trying to record with my webcam in 5s intervalls and do some stuff between starting to record and stoping.
      I took code from here: https://www.autoitscript.com/forum/topic/27925-webcam-example/
      and took what looked relevant to me.
      I use 3 different files:
       Is called WMS.au3 and contains all the constants for the dll calls is called rec.au3 and does all necessary dll calls to start a webcam recording to a file Is called stopcam.exe and does the dll calls to stop recording into a file WMS.au3  :
      $WM_CAP_START = 0x400 $WM_CAP_UNICODE_START = $WM_CAP_START +100 $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81 $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81 $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW $WM_CAP_ABORT = $WM_CAP_START + 69 $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46 $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43 $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41 $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42 $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10 $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11 $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14 $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12 $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12 $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13 $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13 $WM_CAP_EDIT_COPY = $WM_CAP_START + 30 $WM_CAP_END = $WM_CAP_UNICODE_END $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22 $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21 $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21 $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23 $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23 $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25 $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25 $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20 $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20 $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24 $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36 $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1 $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67 $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67 $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65 $WM_CAP_GET_STATUS = $WM_CAP_START + 54 $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8 $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44 $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60 $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61 $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83 $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84 $WM_CAP_PAL_OPENA = $WM_CAP_START + 80 $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80 $WM_CAP_PAL_PASTE = $WM_CAP_START + 82 $WM_CAP_SEQUENCE = $WM_CAP_START + 62 $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63 $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35 $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85 $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2 $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2 $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5 $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3 $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3 $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6 $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7 $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4 $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66 $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66 $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51 $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50 $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52 $WM_CAP_SET_SCALE = $WM_CAP_START + 53 $WM_CAP_SET_SCROLL = $WM_CAP_START + 55 $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64 $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9 $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45 $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72 $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71 $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70 $WM_CAP_STOP = $WM_CAP_START + 68 rec.au3  :
       
      #include <WMS.au3> #include <GUIConstants.au3> if not FileExists(@ScriptDir&"\vid\"&string(@MON)&"\"&string(@mday)) Then DirCreate(@ScriptDir&"\vid\"&"\"&string(@MON)&"\"&string(@mday)) EndIf $moviefile = @ScriptDir&"\vid"&"\"&string(@MON)&"\"&string(@mday)&"\test.avi" $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") FileWrite(@scriptdir&"\clop.clop",$user) $Main = GUICreate("Camera",350,270) $moviefile=@ScriptDir&"\test.avi" $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", $Main, "int", 1) FileWrite(@scriptdir&"\clip.clip",$cap[0]) run(@scriptdir&"\stopcam.exe") DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $moviefile) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0) Stopcam.exe is the compiled version of this:
      #include "WMS.au3" #include <GUIConstants.au3> $cap = Int(FileRead(@scriptdir&"\clip.clip")) $user = int(fileread(@scriptdir&"\clop.clop")) Sleep(10000) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_STOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($user) FileDelete(@scriptdir&"\clip.clip") FileDelete(@scriptdir&"\clop.clop")  
      Unfortunately this is not working as I thought it would be working.
      Does someone see what I´m doing wrong?
      It should record the webcam for about 10 seconds ( a little less) and save that to an .avi file.
      It does not stop the recording , I have to stop the process manually...
      Secondly, which confuses me more is that it creates the test.avi not in the location is specified in the script... its stored in the ScriptDir for whatever reason haha
      I hope you can help me
       
      ~HappyCoding
    • Daydreamer067
      By Daydreamer067
      Hi
      in windows 10 i create a new desktop.
      I want to run a script in this desktop, for exemple Mouseclick("left",x,y)
      I want the script to work in that desktop while i switch to the primary desktop.
      So far autoit clicks on the active desktop.
      Is there a way to make it run only on the other desktop ?
       
      Thank you for your response.
    • codingislife
      By codingislife
      Hi everyone, 
      I'm new to the autoit world and am trying to do something a little complicated and am having trouble developing a solution. My OS after reimaging comes up with two operating system choices during boot up, I'd like to delete the incorrect OS. I have noticed that the default OS is always the correct OS. My issue is I need a way to find the OS identifier before I can delete. I know that I  can use bcdedit to find this but it changes every time and it needs to be the correct identifier (i.e. not the Default or bootmgr). If someone knows of a way to parse through the output of bcdedit to find the identifier that would be greatly appreciated. Here is an example of what I am trying to do:
      https://scottiestech.info/2016/07/03/remove-the-choose-an-operating-system-message-when-starting-your-computer/
    • PramodR
      By PramodR
      Hello,
      i am new to AUTO IT development , I would like one help to read value from a POP up.
      i am able to read below values using inspect tool , information given below, I tried to create a script to read value but that does not help. any help is appreciated.
      Available Controls
      POPUP window Controls
      Auto Id = "UpdateNow_Btn"
      Name = Update Now
      Invoke - Button Control
      Below Controls i get when i move inspector tool to the text which i need to read. i need to read the text Name . Currently with my code i get only blank text 
      Auto Id = timeOutLb
      ClassName = TextBlock
      LegacyIAccess = GetName
      Name  = Read Value for Name
       
      My code.
       
×