MUI open full resolution screen

You can post your code snippets here for others to use and learn from
Post Reply
User avatar
Redlion
Posts: 94
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

MUI open full resolution screen

Post by Redlion »

Hi,

Just another snippet I use sometimes.

It opens a window at the same size as the resolution of the screen.

Code: Select all

@VERSION 5,2
@REQUIRE "MUIRoyale"
@APPTITLE "Max screen"
@APPVERSION "$VER: 1.0 (01.03.15)"
@APPCOPYRIGHT "©2015, George Leo den Hollander"
@APPAUTHOR "Leo den Hollander"
@APPDESCRIPTION "Open big window"

@DISPLAY {Hidden = True}

Function p_MUIEvent(id) ; * Joint event handler for MUI buttons and menus ***********************************
    Switch id
             
        Case "Quit":
            End
    EndSwitch
EndFunction

Function p_EventFunc(msg)
    Switch msg.action
        Case "MUIRoyale":
            Switch msg.attribute
                Case "CloseRequest":
                     End
        
                Case "Pressed":
                    p_MUIEvent(msg.id)
        
            Endswitch

        Case "HideWindow":
            MUI.Set("app", "iconified", True)

        Case "ShowWindow":
            MUI.Set("app", "iconified", False)

    EndSwitch
EndFunction

DTW = getattribute(#Display,0,#AttrMaxWidth)
DTH = getattribute(#Display,0,#AttrMaxHeight)

xml$ =  ReplaceStr(FileToString("blank.xml"), "%DTW", DTW)
xml$ =  ReplaceStr(xml$, "%DTH", DTH)

mui.CreateGui([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="Blank">
]] .. xml$ .. "</application>")

; listen to these events!
InstallEventHandler({MUIRoyale = p_EventFunc, HideWindow = p_EventFunc, ShowWindow = p_EventFunc})

; main loop!
Repeat
    WaitEvent
Forever
and here is the XML file,

Code: Select all

<window title=" Program Name Here" id="window" width="%DTW" height="%DTH" notify="closerequest" >
    <vgroup background="pre_ShadowFill">
        <vgroup>
            <Button id="Quit" notify="pressed" >Quit</Button>
            <rectangle/>
        </vgroup>
    </vgroup>
</window>
This only works if you load in an XML file, you can not put the xml in your HWS program.

Cheers
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Post Reply