CreatePort=ApplicationMsg=application.library event?

Discuss any general programming issues here
Post Reply
User avatar
fingus
Posts: 271
Joined: Fri Sep 16, 2011 9:53 am

CreatePort=ApplicationMsg=application.library event?

Post by fingus »

Does CreatePort did receive ApplicationMsg like standard application.library events?

If not this will be on my wishlist for sure!

I need it for the BACKRXMSG-Call, offered by Ringhio. That is when you clicking on a RINGHIO-Window.
User avatar
fingus
Posts: 271
Joined: Fri Sep 16, 2011 9:53 am

Re: CreatePort=ApplicationMsg=application.library event?

Post by fingus »

*knock* *knock*

Somebody here?
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: CreatePort=ApplicationMsg=application.library event?

Post by airsoftsoftwair »

I don't know anything about Ringhio and application.library as they're OS4 specific. You need to explain what you want to achieve in more detail so I that I can evaluate if it's worth adding to Hollywood if it's not possible already through ARexx.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: CreatePort=ApplicationMsg=application.library event?

Post by djrikki »

Andreas, if I may it a litttle clear on behalf of the OP.

The notifications were which appear in the bottom-left of the Workbench, these are clickable. I think what is being requested is that your hollywood application can listen and action these clicks.

Foreinstance here is a re-life usage on WIndows. 'FireFox has finished downloading your file(s). Click here to see downloads'.

Yes, I have specifically chosen this because it would be useful to have in Jack's AppStore and the Amigaworld notifications that I have in place. E.g. Click the Notification show the AmigaWorld news item in full in the user's preferred browser or switch to the Downloads page tab in the AppStore - this would be the iciing on the cake.

Just to make it clear - I have never looked at implementing this myself - hmm gonna try that know.

I was chatting with Simon Archer only the other day about this exact feature not working correctly in Codebench so I know for sure it's possible at Ringhio level because had fixed the omission in Codebench.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: CreatePort=ApplicationMsg=application.library event?

Post by djrikki »

Unless I have missed something, clicking a notification window does not appear to send a message via Arexx to the host application. So fingus is on to something.

Seen as though I am in a mood for giving code away today here is some more, feel free to use it as you wish.

When the below code is compiled you have an application that firstly sends it's own Arexx message through to Ringhio with a 'Test' message - it will then wait forever to receive Arexx messages and act on them according, in this example there is only one Arexx command that is understood and that is the 'DUMMY' command.

The second piece of code is an arexx script included for completeness.

Code: Select all

/*
************************************************************
**
** Created by: CodeBench 0.30 (23.2.2013)
**
** Project: ArexxDummy
**
** File: 
**
** Date: 09-05-2013 20:18:18
**
************************************************************
*/

Global base, systempartition, application, arexx

base = {}
application = {}
arexx = {}
application.name = "ArexxDummy"
application.exe = {}

Local t  = GetFileAttributes("PROGDIR:ArexxDummy") ; the name of your compiled executable
application.exe.path = PathPart(t.path)

application.platform = GetVersion().platform

If application.platform = "MorphOS"
    systempartition = "MOSSYS:"
Else
    systempartition = "SYS:"
EndIf

CreateRexxPort(application.name .. ".1")

;; base:SendRexxCommand(message,workbench)
; Send a Rexx Message to the Workbench or Ringhio
Function base:SendRexxCommand(message,workbench,url,title)
    Local res$
    
    ExitOnError(False)
    If workbench = false
        If application.platform = "AmigaOS4"

	        res$ = SendRexxCommand("RINGHIO", "'REGISTERAPP APP=" .. application.name .. "'")
	        If url = nil
		        If Exists(application.exe.path .. "resources/" .. application.name .. "_ringhio.png") = True
					res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " CLOSEONDC SCREEN=\"FRONT\" IMG=\"" .. application.exe.path .. "resources/" .. application.name .. "_ringhio.png\" TITLE=\"" .. application.name .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
		        Else
		        	res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " CLOSEONDC SCREEN=\"FRONT\" IMG=" .. systempartition .. "Prefs/Presets/Ringhio/impronta_32.png TITLE=\"" .. application.name .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
		        EndIf
	        Else
				If FindStr(url,"amigaworld") > -1
					If Exists(application.exe.path .. "resources/amigaworld_ringhio.png") = True
			        	res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " BACKRXMSG=\"URL:" .. url .. "\" SCREEN=\"FRONT\" IMG=\"" .. application.exe.path .. "resources/amigaworld_ringhio.png\" TITLE=\"" .. title .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
					Else
			        	res$ = SendRexxCommand("RINGHIO", "'RINGHIO APP=" .. application.name .. " CLOSEONDC SCREEN=\"FRONT\" IMG=" .. systempartition .. "Prefs/Presets/Ringhio/impronta_32.png TITLE=\"" .. application.name .. "\" IMGVALIGN=1 TEXT=" .. message .. "'")
			        EndIf
			    EndIf
	        EndIf
        EndIf
    Else
        If application.platform = "AmigaOS4"
	        res$ = SendRexxCommand("WORKBENCH", "WINDOW '\"" .. message .. "\"' OPEN")            
    	ElseIf application.platform = "AROS"
        	; message = a path to a drawer or volume
	        res$ = SendRexxCommand("WORKBENCH", "WINDOW '\"" .. message .. "\"' OPEN")
    	    debugprint("Calling: " .. res$ .. "\n\nNot working under AROS, cannot open drawer '" .. message .. "\n\nAny clue why anyone?")
    
	    ElseIf application.platform = "MorphOS"
    	    res$ = SendRexxCommand("WORKBENCH", "WINDOW '\"" .. message .. "\"' OPEN")
    	EndIf
    EndIf
    ExitOnError(True)
    
    Return (res$)
EndFunction
    
base:SendRexxCommand("Test",False,"","")

Function Arexx_Parse(msg)
    Switch msg.action
        Case "OnARexx"
        	Switch msg.command
        	    Case "DUMMY"
        	    	debugprint("dummy!")
        	    
	 	  	 	Default
				      Local t = SplitStr(msg.args, "\0")
				      DebugPrint(msg.command, "called with", msg.argc, "argument(s)")
				      For Local k = 1 To msg.argc
				         DebugPrint("Argument", k .. ":", t[k - 1])
				      Next
			EndSwitch
	EndSwitch
EndFunction
    
InstallEventHandler({OnArexx = Arexx_Parse})

Repeat
	WaitEvent
Forever

Code: Select all

/* Dummy! */
options results
address DUMMY.1
DUMMY 
For those who spotted the 'amigaworld' code might want to know why this is in there? Well firstly the code is taken from Jack, secondly every few hours Jack tells the end-user some general news from the Amigaworld RSS Feed. This code branch and the 'url' and 'title' function parameters can safely be removed.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: CreatePort=ApplicationMsg=application.library event?

Post by airsoftsoftwair »

Ok, I think it should be possible to capture these messages from within a Rexx script so it's probably not necessary to add anything to Hollywood here.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: CreatePort=ApplicationMsg=application.library event?

Post by djrikki »

OK, please let us know when you have a working example.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
fingus
Posts: 271
Joined: Fri Sep 16, 2011 9:53 am

Re: CreatePort=ApplicationMsg=application.library event?

Post by fingus »

So they changed that in AmigaOS in the meantime, so maybe my old code works?

I will try it...
Post Reply