26 October 2017, 14:30 | #1 |
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..." }; Code:
{ WZ_LockWindow(winhandle); result = EasyRequest(window, &myreq, NULL, NULL); WZ_UnlockWindow(winhandle); }; Big thanks! |
26 October 2017, 15:28 | #2 |
Registered User
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...") 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); |
26 October 2017, 19:01 | #3 |
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 |
26 October 2017, 20:43 | #4 |
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.
|
26 October 2017, 21:43 | #5 | |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Quote:
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. |
|
27 October 2017, 17:49 | #6 |
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? |
27 October 2017, 19:20 | #7 |
Registered User
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 |
28 October 2017, 07:28 | #8 |
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 |
|
|