<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — Using GUI and User Input With Event Reciever.]]></title>
		<link>https://gprogs.com/viewtopic.php?id=80</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=80&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Using GUI and User Input With Event Reciever..]]></description>
		<lastBuildDate>Wed, 31 May 2006 11:50:19 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Using GUI and User Input With Event Reciever.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=345#p345</link>
			<description><![CDATA[<p>sorry for the delay.&nbsp; the first thing i see is that you have:<br /></p><div class="codebox"><pre><code>        Return False

&#039;----------------- GUI Events ------------------
        If (event.getEventType()=EET_GUI_EVENT)</code></pre></div><p>if im reading that correctly, it will always return before you make it to the GUI If statement so this is probably the cause of your woes.&nbsp; more than likely its there due to copy/paste.&nbsp; try removing that and see if your GUI events start firing.&nbsp; also, you are remembering to create an instance of the T_irrIEventReceiver and setting it on the device correct?</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Wed, 31 May 2006 11:50:19 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=345#p345</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using GUI and User Input With Event Reciever.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=344#p344</link>
			<description><![CDATA[<p>Ok. Actually I don&#039;t get errors but the GUI does not respond to the the events and probably the User Input aswell.<br />I am using the include function of BlitzMax for organization. The event reciver is in one file and the GUI templates are in another.</p><p>Here is the other file.<br /></p><div class="codebox"><pre><code>&#039;===============================================
&#039;----------- Graphic User Interface ------------
&#039;===============================================

&#039;------------------ GUI Skins ------------------

&#039;Global Fonts and Skins
Global skin:T_irrIGUISkin = gui.getSkin()

Global guifont:T_irrIGUIFont = gui.getFont(&quot;media/fonthaettenschweiler.bmp&quot;)
Global hudfont:T_irrIGUIFont = gui.getFont(&quot;media/hudfont.bmp&quot;)
If (guifont.isValid())
    skin.setFont(guifont)
EndIf

&#039;---------------- GUI Templates ----------------

&#039;Temporary
Rem
We add three buttons. The first one closes the engine. The second
creates a window And the third opens a file open dialog. The third
parameter is the id of the button, with which we can easily identify
the button in the event receiver.
EndRem

gui.addButton(T_irrRect_s32.createFromVals(10,210,100,240), Null, 101, &quot;File Open&quot;)
gui.addButton(T_irrRect_s32.createFromVals(10,250,100,290), Null, 102, &quot;New Window&quot;)
gui.addButton(T_irrRect_s32.createFromVals(10,300,100,340), Null, 103, &quot;Quit&quot;)

Rem
Now, we add a static text And a scrollbar, which modifies the
transparency of all gui elements. We set the maximum value of
the scrollbar To 255, because that&#039;s the maximal value for
a color value.
Then we create an other static text And a list box.
endrem

gui.addStaticText(&quot;Transparent Control:&quot;, T_irrRect_s32.createFromVals(150,20,350,40), True)
Local scrollbar:T_irrIGUIScrollBar = gui.addScrollBar(True, T_irrRect_s32.createFromVals(150, 45, 350, 60), Null, 104)
scrollbar.setMax(255)

gui.addStaticText(&quot;Console:&quot;, T_irrRect_s32.createFromVals(50,80,250,100), True)
listbox = gui.addListBox(T_irrRect_s32.createFromVals(50, 110, 250, 180))

&#039;Main Menu

&#039;Player Menu

&#039;Station Menu

&#039;Station Creation</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Tue, 30 May 2006 04:06:27 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=344#p344</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using GUI and User Input With Event Reciever.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=343#p343</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; what are the errors your getting?</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Tue, 30 May 2006 02:40:03 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=343#p343</guid>
		</item>
		<item>
			<title><![CDATA[Using GUI and User Input With Event Reciever.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=341#p341</link>
			<description><![CDATA[<p>I&#039;m trying to use the Event Reciever with GUI and User Input.<br />I tried pasting the both tutorials into my Event Reciever and get some errors.</p><p>Here&#039;s my code. Thanks.</p><div class="codebox"><pre><code>&#039;===============================================
&#039;----------------- User Input ------------------
&#039;===============================================

&#039; due to OnEvent implementation, these must be global
Global cnt:Int = 0
Global listbox:T_irrIGUIListBox

Type MyEventReceiver Extends T_irrIEventReceiver

    Method OnEvent:Int(event:T_irrSEvent)

&#039;---------------- Input Events -----------------
        If (event.getEventType()=EET_KEY_INPUT_EVENT And event.getKeyPressedDown()=True)

            Local Key:Int=event.getKeyInputKey()

            Select Key
            &#039;Thrust
&#039;                Case EKEY_KEY_UP
&#039;                    thrust:Int = 1
&#039;                    Return True

            &#039;Retro
&#039;                Case EKEY_KEY_DOWN
&#039;                    retro:Int = 1
&#039;                    Return True

            &#039;Yaw
                &#039;Right
                Case EKEY_KEY_D
                    Return True
                &#039;Left
                Case EKEY_KEY_A
                    Return True

            &#039;Pitch
                &#039;Up
                Case EKEY_KEY_W
                    Return True
                &#039;Down
                Case EKEY_KEY_S
                    Return True

            &#039;Roll
                &#039;Right
                Case EKEY_KEY_E
                    Return True
                &#039;Left
                Case EKEY_KEY_Q
                    Return True

            &#039;Action Primary
&#039;                Case EKEY_KEY_SPACE
&#039;                    Return True

            &#039;Action Secondary
&#039;                Case EKEY_KEY_CONTROL
&#039;                    Return True

            &#039;Weapon Select
                &#039;Next
&#039;                Case EKEY_KEY_PERIOD
&#039;                    Return True
                &#039;Previous
&#039;                Case EKEY_KEY_COMMA
&#039;                    Return True

            &#039;Item Select
                &#039;Next
&#039;                Case EKEY_KEY_
&#039;                    Return True
                &#039;Previous
&#039;                Case EKEY_KEY_
&#039;                    Return True

                Default
                    Return False
            EndSelect
        EndIf

        Return False

&#039;----------------- GUI Events ------------------
        If (event.getEventType()=EET_GUI_EVENT)

            Local id:Int = event.getGUIEventCaller().getID()
            Local gui:T_irrIGUIEnvironment = device.getGUIEnvironment()

            Local evtype:Int=event.getGUIEventType()

            Select evtype
                Rem
                If a scrollbar changed its scroll position, And it is &#039;our&#039;
                scrollbar (the one with id 104), Then we change the
                transparency of all gui elements. This is a very easy task:
                There is a skin Object, in which all color settings are stored.
                We simply go through all colors stored in the skin And change
                their alpha value.
                EndRem

                Case EGET_SCROLL_BAR_CHANGED
                    If (id = 104)
                        Local Pos:Int = T_irrIGUIScrollBar.createFromHandle(event.getGUIEventCaller().handle,False).getPos()
                        Local i:Int

                        For i=0 To EGDC_COUNT-1
                            Local col:T_irrSColor = gui.getSkin().GetColor(i)
                            col.SetAlpha(Pos)
                            gui.getSkin().SetColor(i,col)
                        Next
                    EndIf

                Rem
                If a button was clicked, it could be one of &#039;our&#039;
                three buttons. If it is the first, we shut down the engine.
                If it is the second, we create a little window with some
                text on it. We also add a String To the list box To Log
                what happened. And If it is the third button, we create
                a file open dialog, And add also this as String To the list box.
                That&#039;s all for the event receiver.
                endrem

                Case EGET_BUTTON_CLICKED

                    If (id = 103)
                        device.closeDevice()
                        Return True
                    EndIf

                    If (id = 102)
                        listbox.addItem(&quot;Window created&quot;)
                        cnt :+ 30
                        If (cnt &gt; 200)
                            cnt = 0
                        EndIf

                        Local Window:T_irrIGUIWindow = gui.addWindow( ..
                            T_irrRect_s32.createFromVals(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt), ..
                            False, .. &#039; modal?
                            &quot;Test window&quot;)

                        gui.addStaticText(&quot;Please close me&quot;, ..
                            T_irrRect_s32.createFromVals(35,35,140,50), ..
                            True, .. &#039; border?
                            False, .. &#039; wordwrap?
                            Window)

                        Return True
                    EndIf

                    If (id = 101)
                        listbox.addItem(&quot;File open&quot;);
                        gui.addFileOpenDialog(&quot;Please choose a file.&quot;)
                        Return True
                    EndIf
            EndSelect
        EndIf

        Return False

    EndMethod

    &#039; we must override the generate function in order for instantiation to work properly
    &#039; must return T_irrIEventReceiver
    Function generate:T_irrIEventReceiver()
        Return T_irrIEventReceiver(New MyEventReceiver)
    EndFunction
EndType</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Mon, 29 May 2006 20:43:04 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=341#p341</guid>
		</item>
	</channel>
</rss>
