English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 28 July 2022, 00:16   #1
DisasterIncarna
Registered User
 
DisasterIncarna's Avatar
 
Join Date: Oct 2021
Location: England
Posts: 1,172
Blitz/Amiblitz ScreenNotify Example?

I have had a look at the screennotify include and unfortunately for clueless OS retards like me, it has no example of how to use it correctly, does anyone know how to correctly use screennotify to detect when workbench is closing and then reopens?
DisasterIncarna is offline  
Old 28 July 2022, 10:01   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
It's not a library I've used, but the include is just a very thin wrapper around the actual library interface, so usage should be essentially the same as with C. The Screennotify archive includes autodocs and an example program, so it should just be a matter of porting that to Blitz.
Daedalus is offline  
Old 30 October 2022, 15:50   #3
super
Registered User
 
Join Date: Oct 2022
Location: Sverige
Posts: 4
ScreenNotify AmiBlitz code ?!

Hi,
I'm been trying to convert the c example from screennotify10 archive
with no luck...
I'm getting to the point where I read out 3, Workbench
Then I should read out true or false ?!
Any Pro that could help me out here ?

XINCLUDE "screennotify.include.ab3"

Port.l = CreateMsgPort("AB3_TemplateII.1")
succ2.l = screennotify_AddWorkbenchClient{Port.l}

snm.l = GetMsg_(Port) ; message ?
If snm <> 0 Then snm_Type.l = GetMsg_(snm) ; get message

NPrint snm

If snm_Type = 3 ; workbench ?

value = ?????

if value = false
CloseGUI{}
NPrint "close"
end if


if value = true
OpenGUI{}
NPrint "open"
end if


ReplyMsg_(snm)
End If

Last edited by super; 30 October 2022 at 15:58.
super is offline  
Old 31 October 2022, 15:32   #4
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
I don't speak Basic too well. I just used this to find out how to work with pointers and structs in Basic: https://eab.abime.net/showpost.php?p...69&postcount=4

If I adopt it right it should be like this:

Code:
*snm.ScreenNotifyMessage = GetMsg_(Port)
if *snm
	type.l = Peek.l(*snm\snm_Type)
	value.l = Peek.l(*snm\snm_Value)

	if type = 3
		if value = 0
			CloseGUI{}
			NPrint "close"
		else
			OpenGUI{}
			NPrint "open"
		end if
	end if
	ReplyMsg_(*snm)
end if
thomas is offline  
Old 31 October 2022, 21:33   #5
super
Registered User
 
Join Date: Oct 2022
Location: Sverige
Posts: 4
Quote:
Originally Posted by thomas View Post
I don't speak Basic too well. I just used this to find out how to work with pointers and structs in Basic: https://eab.abime.net/showpost.php?p...69&postcount=4

If I adopt it right it should be like this:

Code:
*snm.ScreenNotifyMessage = GetMsg_(Port)
if *snm
	type.l = Peek.l(*snm\snm_Type)
	value.l = Peek.l(*snm\snm_Value)

	if type = 3
		if value = 0
			CloseGUI{}
			NPrint "close"
		else
			OpenGUI{}
			NPrint "open"
		end if
	end if
	ReplyMsg_(*snm)
end if
Thanks, It does make most sense but I can't get it working
*snm 1076732392
type 4194312
value 0
hmmmmm
super is offline  
Old 01 November 2022, 09:44   #6
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
I guess you dont have to Peek.l() the values of the struct:

type.l = *snm\snm_Type

will be enough.


Do you know if the screennotify.library still works with AmigaOS 3.2 ?
I tried to do a working example, but I do not get any messages when calling the menu item "Close Workbench".
Honitos is offline  
Old 01 November 2022, 09:58   #7
super
Registered User
 
Join Date: Oct 2022
Location: Sverige
Posts: 4
Quote:
Originally Posted by Honitos View Post
I guess you dont have to Peek.l() the values of the struct:

type.l = *snm\snm_Type

will be enough.


Do you know if the screennotify.library still works with AmigaOS 3.2 ?
I tried to do a working example, but I do not get any messages when calling the menu item "Close Workbench".
Yes it works on 3.2, removing peek gives type 3

ReplyMsg_(*snm.ScreenNotifyMessage) and values 0 & 1 works as well

Last edited by super; 01 November 2022 at 10:25.
super is offline  
Old 02 November 2022, 22:33   #8
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
You dont have to add the datatype .ScreenNotifyMessage everytime just the first time to init it.

I do not get any message, how do you produce it?
Just trying to close the Workbench?
Honitos is offline  
Old 02 November 2022, 22:37   #9
super
Registered User
 
Join Date: Oct 2022
Location: Sverige
Posts: 4
Change screen mode
super is offline  
Old 03 November 2022, 08:58   #10
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
Thanks!
That worked.
Honitos is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz/Amiblitz - Simple way to detect if workbench screen is active/loaded? DisasterIncarna Coders. Blitz Basic 2 31 October 2021 01:33
Blitz Basic / AmiBlitz on AmigaCoding.com Daedalus Coders. Blitz Basic 8 08 January 2021 15:56
Screennotify.library ? utukku support.Other 0 07 January 2021 14:44
Can amiblitz (blitz basic2) blit an image per bitplane? Michael Parent Coders. General 7 29 October 2009 17:59
Blitz Basic 2.x (AmiBlitz, now?) in ADF format? Unregistered Amiga scene 1 30 November 2001 10:46

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12552 seconds with 13 queries