Shortcuts in EasyStruct.es_GadgetFormat

This forum is for general developer support questions.
Post Reply
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

Shortcuts in EasyStruct.es_GadgetFormat

Post by zzd10h »

Hello,
I'm searching for a very little thing.
Is it possible to add a shortcut for each of the choices in a EasyStruct requester ?

For example, I have a
struct EasyStruct
with es_GadgetFormat = "Yes|No".
Is it possible to add a shortcut Y or N for respectively Yes and No choices ?

I still try
es_GadgetFormat = "_Yes|_No". but no effect, except to write _Yes and _No in my requester.

Nevertheless, I found in the ADCD2.1 autodocs that
left Amiga-V select the left choice
and
left Amiga-B select the right choice.

"the key strokes left Amiga V and
left Amiga B correspond to selecting the requester's leftmost or rightmost
gadgets with the mouse, respectively."

It works but it's not really intuitive.

For info, it's not included in my SDK autodocs but it works on my system.

See you and thank by advance for your replys
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by trixie »

@zzd10h

I *think* the underscore technique ("_Yes|_No") was only introduced for GadTools and BOOPSI gadgets (such as those in the ReAction set). Intuition components (such as the Easy Requester) may have never supported it.
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
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by ssolie »

zzd10h wrote: I'm searching for a very little thing.
Is it possible to add a shortcut for each of the choices in a EasyStruct requester ?
I don't think so.

We generally encourage programmers to use requester.class instead. I know it isn't quite as easy but the user experience is a lot richer.

I noticed most use the "easy" requesters as a fallback if something goes seriously wrong because they are very primitive and don't use a lot of system resources. They are more of a last resort these days.
ExecSG Team Lead
User avatar
cha05e90
Posts: 90
Joined: Fri Jun 17, 2011 10:15 pm
Location: Germany
Contact:

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by cha05e90 »

trixie wrote:may have never supported it.
Yep, AFAIK the keyboard shortcuts in the EasyRequesters are "hard coded" and can't be changed.
X1000|II/G4|440ep|2000/060|2000/040|1000
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by zzd10h »

Thank all for your reply,
I have to look to the struct orRequest, if I understand well.
Hoping that it's not to much complicated for me :)
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by chris »

TimedDosRequester is quite good for a lot of cases - it's a bit easier than using requester.class directly.
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by zzd10h »

Gazelle just send me the solution to my problem without to change my EasyRequest and it works,
Thank you Gazelle.

The solution is to use ESF_TAGGED with the tag ESA_Underscore.
I add a "_" to my GadgetFormat sentence and now it works !!!

requestKill.es_Flags = ESF_TAGGED ;
struct TagItem requester_tags[2] ;
requester_tags[0].ti_Tag = ESA_Underscore;
requester_tags[0].ti_Data = '_';
requester_tags[1].ti_Tag = TAG_DONE;
requestKill.es_TagList = requester_tags ;
requestKill.es_GadgetFormat = GetCatalogStr(catalog,MSG_Requester_choix_01,MSG_Requester_choix_01_STR) ; /* _Oui|_Non */

It's easier that to use the requester class and for now this easystruct is enough for my need.

This solution was in the Autodocs but I didn't see it,
sorry for this "RTFM" ;)
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by ssolie »

zzd10h wrote:The solution is to use ESF_TAGGED with the tag ESA_Underscore.
I add a "_" to my GadgetFormat sentence and now it works !!!
Good to know. :)
This solution was in the Autodocs but I didn't see it,
sorry for this "RTFM" ;)
Well, it isn't on the wiki yet. See http://wiki.amigaos.net/index.php/Intui ... Requesters

And any requester.class documentation is missing entirely.

Any help with fixing up the wiki would be greatly appreciated.
ExecSG Team Lead
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by zzd10h »

edit ; bad format
Last edited by zzd10h on Fri Nov 02, 2012 11:12 pm, edited 1 time in total.
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

Re: Shortcuts in EasyStruct.es_GadgetFormat

Post by zzd10h »

Any help with fixing up the wiki would be greatly appreciated.
Certainly that it's not for myself (regarding my knowledge about Amiga and english, but if it was...)

something like this for the easystruct wiki (taken from autodocs and sample) ?

Code: Select all

struct EasyStruct
    {
    ULONG       es_StructSize;
    ULONG       es_Flags;
    UBYTE       *es_Title;
    UBYTE       *es_TextFormat;
    UBYTE       *es_GadgetFormat;
    };

es_Flags
Set to zero. 
	Since v51, can take 4 values
	           ESF_SCREEN - open the requester on the screen specified
	                        in es_Screen (if that is NULL, the default
	                        public screen will be used). (V50)
	           ESF_TAGGED - read and use the additional information
	                        provided via es_TagList. (V50)
		(see below for example of ESF_TAGGED and es_TagList use)
	           ESF_EVENSIZE - make all requester buttons the same width,
	                          i.e. as wide as the widest one. (V50)
	           ESF_INACTIVE - open the requester window in inactive
	                          state, preventing it from stealing the
	                          user input focus. (V51)

es_TagList is a TagItem struct who can contain 2 tags. 
	Usable, only if es_Flags = ESF_TAGGED

	ESA_Position - (UWORD) The on-screen position the requester is to
	    be opened at. The possible choices are:

	        REQPOS_DEFAULT - use position from user preferences
	        REQPOS_CORNER - top left screen corner
	        REQPOS_BELOWBAR - top left corner, below the screen titlebar
	        REQPOS_CENTERMOUSE - center under the mouse pointer
	        REQPOS_CENTERSCREEN - center in visible screen clip
	        REQPOS_CENTERWINDOW - center in supplied reference window
	                              (if this is NULL, center in screen)

	ESA_Underscore - (TEXT) The character used in the gadget format
	    string to indicate that the following letter must be displayed
	    underscored and act as a gadget keyboard shortcut. If this tag
	    is not present, no underscoring is performed for compatibility.

Example :
    	struct TagItem requester_tags[3] ;	
    	requester_tags[0].ti_Tag = ESA_Position;				/* allow to specify where the requester window will be displayed */
    	requester_tags[0].ti_Data = REQPOS_CENTERWINDOW;	/* position the requester window at the center of the application window */ 
    	requester_tags[1].ti_Tag = ESA_Underscore;			/* allow to specify a shortcut character for the es_GadgetFormat choices*/ 
    	requester_tags[1].ti_Data = '_';    					/* the letter following a '_' character will be a shortcut */
    	requester_tags[2].ti_Tag = TAG_DONE;        			/* end of the tags list */

	myES.es_Flags = ESF_TAGGED ; 					/* allow the use of ESA_Position and ESA_Underscore tags */
    	myES.es_TagList = requester_tags ;    
	myES.es_GadgetFormat = "_Yes|_No" ;				/* the requester will display 2 choices with 2 shortcuts ('Y' for Yes and 'N' for No) */
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
Post Reply