English Amiga Board


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

 
 
Thread Tools
Old 26 October 2017, 14:30   #1
mbergmann-sh
 
Posts: n/a
AmiBlitz3: How to open a wizard.library EasyRequest structure?

How can I define and open an EasyRequest structure using wizard library from within AB3? In C, I do it this way:

define a struct:

Code:
/* define Struct for EasyRequest */
#define NO 0
#define YES 1
/* Easy Requester Question */
   struct EasyStruct myreq = {
     sizeof(struct EasyStruct),
     0,
     "Button disabled/enabled",
     "DButtons have changed!",
     "Oh, how nice!|Don't bother me, pal..."
   };
...and call it up:

Code:
{
   WZ_LockWindow(winhandle);													
   result = EasyRequest(window, &myreq, NULL, NULL);													
   WZ_UnlockWindow(winhandle);
};
I have seen that AB3 has WZ_InitEasyStruct() and WZ_EasyRequestArgs(), but since I'm new to Blitz, I don't come clear with it. Can someone please enlight me?

Big thanks!
 
Old 26 October 2017, 15:28   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
I haven't used wizard.library myself, but the arguments should be the same as C. If you don't need those functions in C, you probably don't need them in Blitz either.

You can create the EasyRequest struct anyway using a NewType, that's much the same. Then it's just a case of adjusting the syntax to match Blitz's.

Without testing (sadly they don't let me have an Amiga in my office...), your code might look like this:

Code:
; define Struct for EasyRequest
#NO = 0
#YES = 1

; Easy Requester Question
DEFTYPE .EasyStruct myreq

myreq\es_StructSize = SizeOf .EasyStruct
myreq\es_Flags = 0
myreq\es_Title = GetGlobalStrAddr("Button disabled/enabled")
myreq\es_TextFormat = GetGlobalStrAddr("DButtons have changed!")
myreq\es_ButtonFormat = GetGlobalStrAddr("Oh, how nice!|Don't bother me, pal...")
I think the Newtype assignments can be shorthanded as in C too:

myreq\es_StructSize = SizeOf .EasyStruct, 0, GetGlobalStrAddr("Button disabled/enabled").....

And then the calling:

Code:
  WZ_LockWindow_(*winhandle);
  result.l = EasyRequest_(window, *myreq, Null(), Null());
  WZ_UnlockWindow_(*winhandle);
You'll probably need the all.res file added, and the latest (2016) updates to AB3 since the Null() and GetGlobalStrAddr() functions changed since the 3.6.1 release. GetGlobalStrAddr() is simply a shortcut for assigning a new string variable and passing its address with &tempstring1$ or similar.
Daedalus is offline  
Old 26 October 2017, 19:01   #3
mbergmann-sh
 
Posts: n/a
Hi Daedalus, thanks for your answer!

The definition mostly works, only myreq\es_ButtonFormat = GetGlobalStrAddr("Oh, how nice!|Don't bother me, pal...") throws a offset not found error in AmiBlitz3
 
Old 26 October 2017, 20:43   #4
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
There is probably a stormwizard.include somewhere with a test at the end. try to locate that.
Cylon is offline  
Old 26 October 2017, 21:43   #5
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Quote:
Originally Posted by mbergmann-sh View Post
Hi Daedalus, thanks for your answer!

The definition mostly works, only myreq\es_ButtonFormat = GetGlobalStrAddr("Oh, how nice!|Don't bother me, pal...") throws a offset not found error in AmiBlitz3
Gah! Sorry, was going from memory. It's es_GadgetFormat, not ButtonFormat!

In that case, the shortcut method probably would've worked fine because it doesn't explicitly name each offset.

Anyway, for future reference, the standard structs can be examined in the Definition Browser window, which IIRC is the bottom right by default. Click on Structs and type in the name of the struct/Newtype you're looking for. The list will include all Newtypes currently defined, including ones in your own code, ones in any used includes, and ones in any resident files. Just bear in mind that when the OS defines a pointer within a struct, it's stored as a long value (without the *) instead in Blitz.

That browser also gives a similar handy list of variables and constants.
Daedalus is offline  
Old 27 October 2017, 17:49   #6
mbergmann-sh
 
Posts: n/a
Yes, that soluted the struct.
what about WZ_EasyRequestArgs_ - wouldn't that be the function to use when dealing with wizard.library?
 
Old 27 October 2017, 19:20   #7
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
I would guess so, but like I say, I've never used wizard.library so I really don't know. That function is part of the standard wizard.library API, so if you haven't needed it in the C version and just used the standard OS API, you probably don't need it here either. There doesn't appear to be a single example of that call in the entirety of the AB3 source, even though it uses wizard.library, so I expect using the standard API was preferred for whatever reason.

Also, the BlitzLibs includes a Request() function which can be used for standard system requesters without having to deal with building structs - might be a handy shortcut if you don't need the extra flexibility of OS direct calls
Daedalus is offline  
Old 28 October 2017, 07:28   #8
mbergmann-sh
 
Posts: n/a
yeah - I allready noticed Request(). Unfortunatetly it gives kind of a AOS2-looking requester on my system, that looks different to the wizard GUI I'm experimenting with. But it is indeed handy for a quick solution! Thanks, man!
 
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open rtg.library AGS support.WinUAE 6 02 April 2015 18:41
Open-source graphics library Don_Adan Coders. System 32 15 January 2013 22:15
dos.library Open() hangs MrD Coders. Asm / Hardware 15 24 July 2012 19:55
unable to open reqtools.library RabidRabbit support.WinUAE 6 31 March 2009 13:43
AmigaOS4 version of wizard.library and new AmiPhoto catalogs available Paul News 0 11 July 2006 11:57

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 03:04.

Top

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