GadTools STRING_KIND

This forum is for general developer support questions.
Post Reply
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

GadTools STRING_KIND

Post by JosDuchIt »

I have observed(also under OS3.xx
the behaviour described below of a string gadget created with

gf->gad = CreateGadget (STRING_KIND, gf->gad, &ng,
GTST_MaxChars, bt->arg[7].num,
GTST_String, bt->arg[8].str,
GA_Immediate, TRUE,
GFLG_EXTENDED, extflag,
GT_Underscore, '_',
GA_Disabled, onoff,
GTST_EditHook, tid->hk, //OS4 was &tid->hk
TAG_END);
when i set MaxChars to a low value (eg 30) and i enter a string manually, i am able to type 31 characters, but on using the return button, the value really entered is however truncated to 30 characters;

Is this a known behavior, a bug ?
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 360
Joined: Mon Jan 17, 2011 9:42 pm

Re: GadTools STRING_KIND

Post by Rigo »

The gadgets created by gadtool.library are to be considered for legacy applications that may require them. For any new applications, the AmigaOS4 BOOPSI classes are the default gadget toolkit.

Because of this, it's unlikely that any work will be done on gadtools.library, as all bugs have most likely been found or worked around by now.

Simon
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: GadTools STRING_KIND

Post by JosDuchIt »

Is there anywhere an example (preferrbly string gadget) using Boopsi gadget directly? (no Reaction lyout gadget)
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 360
Joined: Mon Jan 17, 2011 9:42 pm

Re: GadTools STRING_KIND

Post by Rigo »

Probably not, but the same rules apply for string.gadget as any other BOOPSI classes, even the legacy ones.

Create the gadget object, and call AddGadget(). You'll probably have to set up the position and size data in order to get it to be placed where you'd want it. Then you'd probably have to manually calculate the new positions and size when the window is resized etc.

It just sounds all too much like hard work, better to use a layout and do it the easy way :)

Simon
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: GadTools STRING_KIND

Post by JosDuchIt »

Thanks

The resizing code exists allready for all gadtool gadgets in the Gui4Cli source.
The type of gadget resizing can even be defined quite simply.
I think it will be easier to add the 2 gadgets i find lacking some features (string & listbrowser), than going all the way using Reaction & layout gadget.

The spirit of Gui4Cl would probably be lost (eg changing the gui, while running; drag&drop of gadgets)or very difficult to realise.

I am not a good C programmer and did not program in C for over 2 years. So any help with a real BOOPSI gadget is gladly taken. What is probably a small exercice for an experienced programmer will take me much much longer.
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 360
Joined: Mon Jan 17, 2011 9:42 pm

Re: GadTools STRING_KIND

Post by Rigo »

There are BOOPSI examples in the RKRM if you have those. Check the Intuition.library section.

Simon
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: GadTools STRING_KIND

Post by JosDuchIt »

I have spot one, have rewritten it a bit for OS4, but are running in circles with the OS4 hook.

Notably here


SOLVED that one, had a better look at the MakeClass doc

Code: Select all

/***********************************************************/
/**    Make the class and set up the dispatcher's hook    **/
/***********************************************************/
Class   *initRKMButGadClass(void)
{
    Class *cl = NULL;
    extern ULONG HookEntry();     /* defined in amiga.lib */

    if ( cl =  MakeClass( NULL,
                "gadgetclass", NULL,
                sizeof ( struct ButINST ),
                0 ))
    {
        /* initialize the cl_Dispatcher Hook    */
        cl->cl_Dispatcher.h_Entry = HookEntry;
        cl->cl_Dispatcher.h_SubEntry = dispatchRKMButGad;
    }
    return ( cl );
}
giving me the errors


/tmp/ccrQamOA.o: In function `initRKMButGadClass':
C_Boop_RKMButClass.c:(.text+0xb96): undefined reference to `HookEntry'
C_Boop_RKMButClass.c:(.text+0xb9a): undefined reference to `HookEntry'
User avatar
abalaban
Beta Tester
Beta Tester
Posts: 456
Joined: Mon Dec 20, 2010 2:09 pm
Location: France
Contact:

Re: GadTools STRING_KIND

Post by abalaban »

IIRC HookEntry was in amiga.lib under pre AOS 4, its job was to setup correctly the stack and prepare the function call. Now you don't need it anymore under AOS4 and you can directly set h_Entry to point to dispatchRKMButGad.
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: GadTools STRING_KIND

Post by trixie »

JosDuchIt wrote: C_Boop_RKMButClass.c:(.text+0xb96): undefined reference to `HookEntry'
C_Boop_RKMButClass.c:(.text+0xb9a): undefined reference to `HookEntry'
In the 68k AmigaOS, HookEntry() was used to put the three hook function parameters on the stack and invoke the function in h_SubEntry. This is no longer the case under OS4, you don't need a hook entry point any more - the hook function alone will do. If older docs told you to

cl->cl_Dispatcher.h_Entry = HookEntry;
cl->cl_Dispatcher.h_SubEntry = dispatchRKMButGad;

you now should do

cl->cl_Dispatcher.h_Entry = dispatchRKMButGad;
cl->cl_Dispatcher.h_SubEntry = NULL;

or even better, use AllocSysObjectTags() to initialize the hook.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: GadTools STRING_KIND

Post by JosDuchIt »

@abalaban @trixie

thanks, i am nearly 74 years old and tending to overlook what is evident in the doc.
Post Reply