Jump to content
BBs19

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

Recommended Posts

This should be included into KODA and any other skin generator.
I personally would love to see this incorporated into KODA with the theme options. 

To be honest, I hate wasting time reinventing the wheel. I just want to get down to coding functions and leave the form building to KODA. 

 

 

Share this post


Link to post
Share on other sites
On ‎28‎.‎01‎.‎2018 at 11:41 AM, BBs19 said:

Hi, you can use it however you like in your project..You also don't need to set any link in your program.

Thanks, I found out  MetroGUI UDF very useful. I always mention in the readme file, the authors of interesting code that I use in my programs.:)

Share this post


Link to post
Share on other sites

Hi , BBs19

i'm using Win10x64 and your Example file (Example.au3).

when i click Maximize button, then i click FullScreen Button ,  then click restore Button more time, why GUI not back to Maximize 

(Sorry my english  :sweating: )

Share this post


Link to post
Share on other sites
On 11/4/2017 at 11:51 AM, BBs19 said:

 

The HiWord in wParam is different when disabling and clicking, you are not checking that in your script.

Try this:

Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If   BitShift($wParam, 16) = 0 And BitAND($wParam, 0xFFFF) = $sStopButton Then
        $stop = True
        _CheckStop()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

Hi again, as i said that works fine... until in the function _CheckStop() i try to create a MetroMsgBox. The original checkStop()

 function looks like this:

Func _MyCheckStop()
    If $stop Then
        $answer = MsgBox($MB_YESNO, "A confirmation is required", "Are you sure you want to finish the process?")
        _GUIDisable($Form1, 0, 30)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

 When i added the Metro MsgBox:

Func _MyCheckStop()
    If $stop Then
        $answer =  _Metro_MsgBox(4, "A confirmation is required", "Are you sure you want to finish the process?", 350, 11, $Form1)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

This is how the msgBox looks when it appears:

Capture.PNG

 

I guess it's something i'm doing in the _WM_COMMAND but can not figure out what...

Share this post


Link to post
Share on other sites
On 4.2.2018 at 2:24 PM, 123disconnect said:

Hi , BBs19

i'm using Win10x64 and your Example file (Example.au3).

when i click Maximize button, then i click FullScreen Button ,  then click restore Button more time, why GUI not back to Maximize 

(Sorry my english  :sweating: )

I tested it multiple times, can't reproduce it. Maybe you can test the version i posted on the previous page.

 

2 hours ago, lillo78 said:

Hi again, as i said that works fine... until in the function _CheckStop() i try to create a MetroMsgBox. The original checkStop()

 function looks like this:

Func _MyCheckStop()
    If $stop Then
        $answer = MsgBox($MB_YESNO, "A confirmation is required", "Are you sure you want to finish the process?")
        _GUIDisable($Form1, 0, 30)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

 When i added the Metro MsgBox:

Func _MyCheckStop()
    If $stop Then
        $answer =  _Metro_MsgBox(4, "A confirmation is required", "Are you sure you want to finish the process?", 350, 11, $Form1)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

This is how the msgBox looks when it appears:

Capture.PNG

 

I guess it's something i'm doing in the _WM_COMMAND but can not figure out what...

I am having the same problem right now :D I am using WM_NOTIFY but with the same result. It seems like spawning a GUI from registered messages causes a bug.

I remember having the same problem with my TV-Show-Manager when I was working on it but it somehow worked suddenly, I don't know what the problem was. I will let you know when I figure it out.

Share this post


Link to post
Share on other sites
1 hour ago, BBs19 said:

I am having the same problem right now :D I am using WM_NOTIFY but with the same result. It seems like spawning a GUI from registered messages causes a bug.

I remember having the same problem with my TV-Show-Manager when I was working on it but it somehow worked suddenly, I don't know what the problem was. I will let you know when I figure it out.

Nope, can't figure it out. The problem exsists without MetroGUI. Same problem when using _ArrayDisplay. Script just hangs up when you start GUIs from WM_Notify.

I remember giving up with TV-Show-Manager when I had this problem and it worked all by it self :D

I will need check out a few scripts of mine where it worked, maybe I am missing something. 

Example script to demonstrate the problem:

#include <GUIConstantsEx.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>
#include <Array.au3>


$MainGUI = GUICreate("Alert", 940, 306, -1, -1, $WS_POPUP, -1)
GUICtrlCreateLabel("Alert", 400, 8, 99, 27)


$ListView1 = GUICtrlCreateListView("a|n|n|n|x", 2, 48, 936, 217)
GUICtrlCreateListViewItem("1|2|3|4|5", $ListView1)


GUISetState(@SW_SHOW, $MainGUI)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd


Func _RightClick($TicketID)
    Local $ButtonsArray[2] = ["btn1", "btn2"]
    _ArrayDisplay($ButtonsArray)
EndFunc   ;==>_RightClick

Func WM_NOTIFY($hwnd, $iMsg, $iwParam, $lParam)
    #forceref $hwnd, $iMsg, $iwParam
    Local $tNMHDR = DllStructCreate($tagNMLISTVIEW, $lParam)
    Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    Local $iCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
        Case GUICtrlGetHandle($ListView1)
            Switch $iCode
                Case $NM_RCLICK
                    _RightClick(0)
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

 

Share this post


Link to post
Share on other sites
20 hours ago, lillo78 said:

Hi again, as i said that works fine... until in the function _CheckStop() i try to create a MetroMsgBox. The original checkStop()

 function looks like this:

Func _MyCheckStop()
    If $stop Then
        $answer = MsgBox($MB_YESNO, "A confirmation is required", "Are you sure you want to finish the process?")
        _GUIDisable($Form1, 0, 30)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

 When i added the Metro MsgBox:

Func _MyCheckStop()
    If $stop Then
        $answer =  _Metro_MsgBox(4, "A confirmation is required", "Are you sure you want to finish the process?", 350, 11, $Form1)
        If $answer=$IDYES Then
             _iMExit()
             Exit
        Else
            $stop = False
        EndIf
    EndIf
EndFunc

This is how the msgBox looks when it appears:

Capture.PNG

 

I guess it's something i'm doing in the _WM_COMMAND but can not figure out what...

Finally figured it out. I found two workarounds. First one is to use GUIRegisterMsg like it is suggested in the help file, which would be to prevent using any script pausing commands and return instantly in your WM_COMMAND/WM_NOTIFY. What you would do is basically set a variable to true and return and then check in your main loop if the variable is true and execute the desired function.

I find this solution not good tho for my case with a right-click menu, as checking in main while loop can cause some delay if you are already doing other stuff in it and also because you need to add a sleep in the while loop. 

So how to fix it to work like onevent mode? Register WM_NCACTIVATE or WM_NCPAINT message and it suddenly works for what fkn reason ever :mellow: 

 

GUIRegisterMsg($WM_NCACTIVATE, "_Workaround")

Func _Workaround($hwnd, $iMsg, $iwParam, $lParam)
    return $GUI_RUNDEFMSG
EndFunc

 

Share this post


Link to post
Share on other sites
On 2/14/2018 at 8:47 AM, BBs19 said:

Finally figured it out. I found two workarounds. First one is to use GUIRegisterMsg like it is suggested in the help file, which would be to prevent using any script pausing commands and return instantly in your WM_COMMAND/WM_NOTIFY. What you would do is basically set a variable to true and return and then check in your main loop if the variable is true and execute the desired function.

I find this solution not good tho for my case with a right-click menu, as checking in main while loop can cause some delay if you are already doing other stuff in it and also because you need to add a sleep in the while loop. 

So how to fix it to work like onevent mode? Register WM_NCACTIVATE or WM_NCPAINT message and it suddenly works for what fkn reason ever :mellow: 

 

GUIRegisterMsg($WM_NCACTIVATE, "_Workaround")

Func _Workaround($hwnd, $iMsg, $iwParam, $lParam)
    return $GUI_RUNDEFMSG
EndFunc

 

Coll, thank you so much. I'll try it out and let you know... 

Thanks!

Share this post


Link to post
Share on other sites
On ‎3‎/‎1‎/‎2018 at 7:02 AM, TheDeath said:

Nice Think BBs19!

 

Are you plan to integrating tab?

Long time lurker, first time poster just to answer this...because I had the same need earlier this week.

I mod'd the latest Metro UDF to include the tab code posted earlier in the thread.... It's dirty because I'm not as swift as some of the other folks here, but it works marginally well and themes correctly. I haven't torture tested it but I'll attach a moded Metro example UDF, it doesn't work so hot with the "Themes Demo", maybe someone else can sort that out.

I did have to include the old "GUICtrlOnHover.au3" to make the mash-up work, someone else can probably do better. It's attached below, feel free to use but BBs19 will probably spit on my butchery :)

 

MetroGUI_UDF_Tab.au3

GUICtrlOnHover.au3

Example.au3

Edited by Pheerless

Share this post


Link to post
Share on other sites

i tried to use tab, replace MetroGUI_UDF.au3 by MetroGUI_UDF_tab.au3 in exemple.au3 to use tab function, and obtain error :

"F:\Ancien_pc\script autoit\MetroGui\Tab\MetroGUI-UDF\MetroGUI_UDF_tab.au3" (3750) : ==> Variable must be of type "Object".:
If $Obj.ctrl == $Ctrl Then Return $____aTabBtnList[$Index]
If $Obj^ ERROR

autoit 3.3.14.3

Did i made mistake?

Modified 2018/03/09

This error disappear after installation of version 3.3.14.4.

Thanks for your works ;-)

 

 

Edited by kaz

Share this post


Link to post
Share on other sites
On 06/03/2018 at 9:42 PM, kaz said:

i tried to use tab, replace MetroGUI_UDF.au3 by MetroGUI_UDF_tab.au3 in exemple.au3 to use tab function, and obtain error :

"F:\Ancien_pc\script autoit\MetroGui\Tab\MetroGUI-UDF\MetroGUI_UDF_tab.au3" (3750) : ==> Variable must be of type "Object".:
If $Obj.ctrl == $Ctrl Then Return $____aTabBtnList[$Index]
If $Obj^ ERROR

autoit 3.3.14.3

Did i made mistake?

Modified 2018/03/09

This error disappear after installation of version 3.3.14.4.

Thanks for your works ;-)

 

 

just copy folder MetroUDF-5.1 into auto-it install path "\include" folder

test example.au3 next

Edited by Reekod

Share this post


Link to post
Share on other sites

Hi there 

really nice work, why don't you share the 5.2 version used in your TV shows APPS ? 

the _List_CreateGUI is a pure and wonderfull advance for Auto-it scripting

regards


 

Edited by Reekod

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

    • By gahhon
      I have a application that have a function is to create a shortcut to desktop, lets say is ChromePortable.lnk.
      $iCreate = FileCreateShortcut($DIR_WA_FOLDER & '\GoogleChromePortable.exe', $DIR_SHORTCUT, $DIR_WA_FOLDER, '--kiosk "https://example.com/"') So the shortcut will be launch as kiosk mode and force to enter the specific website. However, the user is still able to right-click on the shortcut and modify the target value to remove the kiosk mode. What can I do to disable the user to editing the target value?
      So far, I had asked and tried from SuperUser for advises Disable Shortcut Target Field
      icacls "ChromePortable.lnk" /GRANT EVERYONE:RX So this will set the permission of this shortcut file to only Read & Execute only! But after I set it, the user is still can modify.
      Please kindly advise.
      Please note and assume that user don't have Administration account or etc, that should be only have 1 account to logon to the computer.
       
      EDIT:
      I must disable inheritance to remove all others permissions like SYSTEM, ADMINISTRATORS, etc. Then only GRANT everyone for READ & EXECUTE only.
      But still the user can go to edit the permissions tho. Any advise?
    • By ur
      When I compiled my script or any script to exe using 32 bit compiler and ran on 32 bit machine, I am getting below error.
       

       
      But it is 32 bit only.
       
      And, for testing, I disabled smart screen also, but same issue.
      Please suggest.
       
    • By sadakathullah
      Hi All, I am new to AutoIT and exploring options to use it in my organization. I tried couple of examples and it is fantastic. I am trying to run restrictions test in a pc to see if certain options are disabled like print screen, mstsc etc. I could not get a hang of it. Any help is much appreciated.
    • By stayready40
      Hello all. I created a script to uninstall Symantec from our environment and I placed the "BlockInput(1)" command in the beginning of the script so that end users would not be able to move the mouse or keyboard to disrupt the mouse clicks.
      During testing we found that this worked for our Windows 7 machines, but for our windows 10 machines the mouse disable did not work can anyone shed some light on why this is? 
      Here is my code:

       
    • By faustf
      hi guys
      i have a script  like this,  in windows 7 work perfect , in windows 10 not  work  , some one can explain me  why ??'
      #include <Array.au3> #include <MsgBoxConstants.au3> Global $aGPathFoto= FileReadToArray (@ScriptDir & "\TEMP\PathFoto.txt") Local $ctrl = 0 While 1 Local $hWnd = WinWait("[CLASS:#32770]", "", 10) If WinExists("[CLASS:#32770]") Then If $ctrl < 2 Then ControlSend($hWnd, "Choose File to Upload", "[CLASS:Edit; INSTANCE:1]", $aGPathFoto[0]&"{Enter}") Exit $ctrl += 1 Else ExitLoop EndIf EndIf WEnd $aGpathfoto = C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
×
×
  • Create New...