Jump to content

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


BBs19
 Share

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. 

 

 

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
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.:)

Link to comment
Share on other sites

  • 2 weeks later...
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...

Link to comment
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.

Link to comment
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

 

Link to comment
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

 

Link to comment
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!

Link to comment
Share on other sites

  • 2 weeks later...
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
Link to comment
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
Link to comment
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
Link to comment
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
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

×
×
  • Create New...