Hi, just trying to add a requester that timesout:
..
requester = IIntuition->NewObject(NULL, "requester.class",
REQ_TitleText, VERS" ("DATE")",
REQ_BodyText, reqtext,
REQ_GadgetText, GetString(&li, MSG_REQ_ABORT_BUTTON),
REQ_TimeOutSecs, reqtout,
TAG_DONE);
answer = IIntuition->IDoMethod(requester, RM_OPENREQ, NULL, NULL, NULL);
IIntuition->DisposeObject(requester);
if(answer == 0) // user ABORTed reboot/poweroff 'LAST CHANCE', end properly
..
reqtext string is:
\033cSystem will %s in \033b%d\033n seconds.\nPlease wait!!!
It shows the time (reqtout) the user defined in reqtext string, but is it posible that such number/countdown is visible (real time) in the requester?
Ant chance that with IIntuition->DoGadgetMethod() can I achieve what I'm trying?
Just newbie to programming. If soimeone can just point me (web/code/SDK autodocs..) where to look i'll be very happy.
Just uploaded all c source here (poff.c). In my account/content. Is it visible for everyone? If not what must I do/change for free-viewing such piece of "great" mess-code. ;-)
TIA
@Jabirulo:
According to the autodocs, REQ_BodyText accepts OM_NEW , OM_SET methods, so it should be safe to RefreshSetAttrs() with the updated string.
The function you want is SetAttrs(), RefreshGadgetAttrs() is for gadgets only. Other than that I don't see how you would do this given that the RM_OPENREQ method doesn't return until after the requester has been closed either because it timed out or the user clicked it away.
I tried with this piece of code:
But requester opens/closes (flickers), don't know how to proceed.
So I changed to use ReAction and fuelgauge_cl and shows better.
TIA
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Opening one requester on top of another is a hopelessly brain-dead idea, you'd better implement your own solution. But Requester Class could do with an enhancement: if it can support timeout (which it does), it could also support displaying the countdown.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
Yes, its quite ugly think IMHO, will fill a BZ enhancement ASAP.
Other thing I get 'warning: assignment from incompatible pointer type' pointing to FuelGaugeEnd. Any idea why? (sec is a int32 variable if it matters)
TIA
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
How is gadgets[] defined?
I'm guessing you have defined the gadgets array as 'struct Gadget *'. This causes the warning as the return value from NewObject() is of type 'Object *' (FuelGaugeObject is just a fancy macro that hides the call to NewObject()). Either add a cast like:
LAYOUT_AddChild, gadgets[GID_GAUGE] = (struct Gadget *)FuelGaugeObject
or just change the gadgets array type to 'Object *' (may require casts in other places though, like if you use SetGadgetAttrs()).
@thomas & salass00
struct Gadget *gadgets[GID_LAST];
cast'ed
LAYOUT_AddChild, gadgets[GID_GAUGE] = (struct Gadget *)FuelGaugeObject,
and no more warning. THX.
BTW is there a "big" problem/bug if not cast'ed? OR is just gcc parser/compiler issue (don't know how to explain, hope you understand what I mean) TIA
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
The cast in this case is basically just a way to tell the compiler to shut up and that you know what you're doing. You could just ignore the compiler warning or disable it but I wouldn't recommend it as compiler warnings can be useful to find mistakes that really are bugs too.
@jabirulo
Older ReAction examples (even some in the SDK I think) declare BOOPSI gadgets as pointers to struct Gadget. However, since one of the recent SDKs all BOOPSI objects are meant to be declared as Object pointers so I suggest you do that in your code as well. But as salass00 says, you'll need to cast them to (struct Gadget *) for SetGadgetAttrs() or RefreshSetGadgetAttrs() because these functions take a struct Gadget pointer as parameter.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2