Jump to content
youtuber

Metro GUI Radio Check issue

Recommended Posts

youtuber

this is my problem

$GiveMessageButton = _Metro_CreateButton("Message Button", 432, 150, 75, 25)

$rgrp_1 = 1
$Radio1 = _Metro_CreateRadio($rgrp_1, "Radio 1", 424, 40, 185, 22)
$Radio2 = _Metro_CreateRadio($rgrp_1, "Radio 2", 424, 90, 185, 22)
_Metro_RadioCheck($rgrp_1, $Radio1)

Case $Radio1
    _Metro_RadioCheck(1, $Radio1)

Case $Radio2
     _Metro_RadioCheck(1, $Radio2)

Case $GiveMessageButton
    If _Metro_RadioCheck(1, $Radio1) Then
ConsoleWrite("Radio 1 selected!" & @CRLF)

    Else
ConsoleWrite("Radio 2 selected!" & @CRLF)
       EndIf

 

Share this post


Link to post
Share on other sites
Melba23

youtuber,

You do realise that almost no-one is likely to have the correct UDF to run that snippet? At the very least you could provide a link to the MetroGUI UDF.

And what exactly is the problem you have - or are we supposed to guess?

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
youtuber

How To Read if radio button is selected

Case $Radio1
    _Metro_RadioCheck(1, $Radio1)
Case $Radio2
     _Metro_RadioCheck(1, $Radio2)
     
        Case $GiveMessageButton
    If GUICtrlRead($Radio1) = 1 Then
ConsoleWrite("Radio 1 selected!" & @CRLF)
    Else
ConsoleWrite("Radio 2 selected!" & @CRLF)
       EndIf

 

#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe
#AutoIt3Wrapper_Res_HiDpi=y
#NoTrayIcon
#include "MetroGUI-UDF\MetroGUI_UDF.au3"

_SetTheme("DarkTeal")
_Metro_EnableHighDPIScaling()

$Form1 = _Metro_CreateGUI("Form1", 615, 413, -1, -1, True)
$Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True)
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]

$GiveMessageButton = _Metro_CreateButton("Message Button", 432, 150, 75, 25)

$rgrp_1 = 1
$Radio1 = _Metro_CreateRadio($rgrp_1, "Radio 1", 424, 40, 185, 22)
$Radio2 = _Metro_CreateRadio($rgrp_1, "Radio 2", 424, 90, 185, 22)
_Metro_RadioCheck($rgrp_1, $Radio1)

Dim $MenuButtonsArray[1] = ["Exit"]

GUICtrlSetResizing($Radio1, 768 + 1 + 32)
GUICtrlSetResizing($Radio2, 768 + 1 + 32)
GUICtrlSetResizing($GiveMessageButton, 768 + 8)

GUISetState(@SW_SHOW)
While 1
    _Metro_HoverCheck_Loop($Form1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Form1)
            Exit
        Case $GUI_MAXIMIZE_BUTTON
            GUISetState(@SW_MAXIMIZE)
        Case $GUI_RESTORE_BUTTON
            GUISetState(@SW_RESTORE)
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON
            _Metro_FullscreenToggle($Form1, $Control_Buttons)
    Case $GUI_MENU_BUTTON
            Local $MenuSelect = _Metro_MenuStart($Form1, $GUI_MENU_BUTTON, 302, $MenuButtonsArray, "Segoe UI", 9, 0)
            Switch $MenuSelect
                Case "0"
                    ConsoleWrite("Returned 5 = Exit button clicked." & @CRLF)
                    _Metro_GUIDelete($Form1)
                    Exit
            EndSwitch


Case $Radio1
    _Metro_RadioCheck(1, $Radio1)

Case $Radio2
     _Metro_RadioCheck(1, $Radio2)

Case $GiveMessageButton
    If _Metro_RadioCheck(1, $Radio1) Then
ConsoleWrite("Radio 1 selected!" & @CRLF)

    Else
ConsoleWrite("Radio 2 selected!" & @CRLF)
       EndIf

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
Skeletor

Something like this?

#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe
#AutoIt3Wrapper_Res_HiDpi=y
#NoTrayIcon
#include "MetroGUI_UDF.au3"

_SetTheme("DarkTeal")
_Metro_EnableHighDPIScaling()

$Form1 = _Metro_CreateGUI("Form1", 300, 200, -1, -1, True)
$Control_Buttons = _Metro_AddControlButtons(True, False, True, True, False)
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
;$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
;$GUI_MENU_BUTTON = $Control_Buttons[6]



$rgrp_1 = 1
$Radio1 = _Metro_CreateRadio($rgrp_1, "Radio 1", 20, 90, 185, 22)
$Radio2 = _Metro_CreateRadio($rgrp_1, "Radio 2",20, 120, 185, 22)
_Metro_RadioCheck($rgrp_1, $Radio1)
$GiveMessageButton = _Metro_CreateButton("Click Me", 20, 150, 100, 25)

Dim $MenuButtonsArray[1] = ["Exit"]

GUICtrlSetResizing($Radio1, 768 + 1 + 32)
GUICtrlSetResizing($Radio2, 768 + 1 + 32)

GUISetState(@SW_SHOW)
While 1
    _Metro_HoverCheck_Loop($Form1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Form1)
            Exit
        Case $GUI_RESTORE_BUTTON
            GUISetState(@SW_RESTORE)
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $GUI_FSRestore_BUTTON
            _Metro_FullscreenToggle($Form1, $Control_Buttons)

        Case $Radio1
            _Metro_RadioCheck(1, $Radio1)
            MsgBox(-1,"Radio 1 selected!", "You have chosen the first radio button")

        Case $Radio2
            _Metro_RadioCheck(1, $Radio2)
            MsgBox(-1,"Radio 2 selected!", "You have chosen the second radio button")

        Case $GiveMessageButton
            MsgBox(-1,"Thank You for Clicking", "You clicked me")
    EndSwitch
WEnd

 

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

×