InstallEventHandler & RapaGUI...

Discuss GUI programming with the RapaGUI plugin here
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

InstallEventHandler & RapaGUI...

Post by Tuxedo »

Ok guys...
probably the most stupid question of all time...
I tryed to change the eventhandler in the RapaGUI tutorial script this way:

InstallEventHandler({RapaGUI = p_EventFunc, OnKeyDown = p_EventFunc})

To check when a key is pressed to do some tests...

However seems that the event wasnt installed but only the RapaGUI callback was installed...

For sure I make some weird mistake but...what?

Thank you for patience...
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: InstallEventHandler & RapaGUI...

Post by airsoftsoftwair »

Are you expecting "OnKeyDown" to report key presses in a RapaGUI window? That won't work. "OnKeyDown" will only work with normal Hollywood displays. If you want to have "OnKeyDown" for a RapaGUI window, you need to embed a Hollywood display inside the RapaGUI window to get "OnKeyDown".
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

Re: InstallEventHandler & RapaGUI...

Post by Tuxedo »

Ok,
Thank you.
I want, for exercise, to add a function that add automatically to the List the typed strings after press enter.
I really hate to press the add button every time...
And dont seems that in RapaGUI there was a finction/callback to do that...or I'm wrong?
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: InstallEventHandler & RapaGUI...

Post by airsoftsoftwair »

Textentry.Acknowledge is your friend.
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

Re: InstallEventHandler & RapaGUI...

Post by Tuxedo »

ho my....
As wrote above "most stupid question ever..." SORRY!

BTW, maybe I discovered one bug...

I've do that:

Code: Select all

/* RapaGUI Tutorial */

@APPTITLE "RapagGUI Tutorial"
@APPVERSION "$VER RapaGUI Tutorial 1.0 (29.12.2015)"
@APPCOPYRIGHT "Copyright 2015, Andreas Falkenhann"
@APPAUTHOR "Andreas Flakenhann"
@APPDESCRIPTION "Il tutorial dalla guida di RapaGUI"




@REQUIRE "RapaGUI"

Function p_EventFunc(msg)
;	DebugPrint(msg.class, msg.Attribute, msg.id, msg.action, msg.)
	Switch msg.CLass

	Case "Menuitem":
		Switch msg.Attribute
		Case "Selected":
			Switch msg.id
			Case "menuabout":
				moai.Request("Test", "Test program\n" ..
					"C 2015 by Andreas Falkenhann", "OK")
			Case "menuaboutrapagui":
				moai.DoMethod("app", "aboutrapagui")
			Case "menuquit":
				End
			EndSwitch
		EndSwitch

	Case "Listview":
		Switch msg.Attribute
		Case "Active":
			s$ = moai.DoMethod("mylistview", "getentry", "active")
			moai.Set("mystring", "text", s$)
			moai.Set("mybt2", "disabled", IIf(msg.triggervalue = -1, True, False))
		EndSwitch

	Case "Textentry":	; quì ci entro se premo "RETURN"
		s$ = moai.Get("mystring", "text")
		moai.DoMethod("mylistview", "insert", "sorted", s$)
	Wait(5)		; ***************** Without that  Wait() the * moai.Set("mywin", "ActiveObject", "mystring") * DONT works here...
		moai.Set("mywin", "ActiveObject", "mystring")

	Case "Button":	; quì ci entro se premo un PULSANTE
		Switch msg.Attribute
		Case "Pressed":
			Switch msg.ID
			Case "mybt1":	; E' stato premuto il pulsante "Aggiungi"
				s$ = moai.Get("mystring", "text")
				moai.DoMethod("mylistview", "insert", "sorted", s$)
				moai.Set("mywin", "ActiveObject", "mystring")
			Case "mybt2":	; E' stato premuto il pulsante "Rimuovi"
				moai.DoMethod("mylistview", "remove", "active")
			EndSwitch
		EndSwitch
	EndSwitch
EndFunction


moai.CreateApp(FileToString("TutorialGUI.xml"))

InstallEventHandler({RapaGUI = p_EventFunc})

Repeat
	WaitEvent
Forever
With that gui definition:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
	<menubar id="mymenubar">
		<menu title="File">
			<item id="menabout">About...</item>
			<item id="menaboutrapagui">About RapaGUI...</item>
			<item/>
			<item id="menuquit">Quit</item>
		</menu>
	</menubar>

	<window title="Esempio RapaGUI" id="mywin" menubar="mymenubar">
		<vgroup>
			<listview id="mylistview" notify="active">
				<column/>
			</listview>
			<hgroup>
				<label align="right">_Pippo</label>
				<textentry id="mystring" notify="acknowledge"/>
			</hgroup>
			<hgroup>
				<button id="mybt1">Aggiungi</button>
				<button id="mybt2">Rimuovi</button>
			</hgroup>
		</vgroup>
	</window>
</application>
As described on the note while pressing Return the textentry doesnt "reactivate" automatically if the Wait() wasnt present...with the "Add" button all work as expected instead...
A bug or my fault somewhere?

Thank you!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: InstallEventHandler & RapaGUI...

Post by airsoftsoftwair »

Which platform?
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

Re: InstallEventHandler & RapaGUI...

Post by Tuxedo »

AmigaOS4.1FEupd1 on Pegasos2 g4
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: InstallEventHandler & RapaGUI...

Post by airsoftsoftwair »

I can reproduce it. Could be a MUI bug (or feature). Thore should be able to explain this so it might be worth filing a ticket over at http://muidev.de for it...
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

Re: InstallEventHandler & RapaGUI...

Post by Tuxedo »

ok,
I'll try to do that...not so expert however... ;P
Thore will have patience.
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
Tuxedo
Posts: 333
Joined: Sun Feb 14, 2010 12:41 pm

Re: InstallEventHandler & RapaGUI...

Post by Tuxedo »

I tryed to submit a bug in MUI bugtracker but get always(tryed 3 times):

Trac error
Submission rejected as potential spam
Akismet says content is spam

What to do?
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Post Reply