How to use TagItem in TDR_EasyStruct (TimedDosRequesterTags() function)?

7 posts / 0 new
Last post
jabirulo
jabirulo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2013-05-30 00:53
How to use TagItem in TDR_EasyStruct (TimedDosRequesterTags() function)?
Hi, just tried to use TimedDosRequesterTags() and change its 'EasyStruct' using TDR_EasyStruct, as I want the requeter to opne centered on a ReAction GUI window I'm developing. Seems I'm (as usual) missing something, 'cos it always pops up centered on screen. Are the TagItem I set ok? BTW pwindow is a 'struct Window' defined globally on source.
  1. uint32 DoMessage(char *message, char reqtype, STRPTR buttons)
  2. {
  3. int32 nDummy;
  4. struct TagItem es_ti[] = { {ESA_Position, REQPOS_CENTERWINDOW}, {TAG_DONE, 0} };
  5. struct EasyStruct es;// = {sizeof(struct EasyStruct),
  6. // ESF_TAGGED,
  7. // "DefMousePointers", NULL, NULL,
  8. // NULL, es_ti
  9. // };
  10. es.es_StructSize = sizeof(struct EasyStruct);
  11. es.es_Flags = ESF_TAGGED;
  12. es.es_Title = "DefMousePointers";
  13. es.es_TagList = es_ti;
  14.  
  15.  
  16. nDummy = IDOS->TimedDosRequesterTags(//TDR_TitleString, "DefMousePointers",
  17. TDR_GadgetString, buttons? buttons : GetString(&li,MSG_OK_GAD),
  18. TDR_FormatString, message,
  19. TDR_ImageType, TDRIMAGE_ERROR,
  20. TDR_Window, pwindow,
  21. TDR_EasyStruct, &es,
  22. TAG_DONE);
  23. return nDummy;
  24. }
thomas
thomas's picture
Offline
Last seen: 3 weeks 20 hours ago
Joined: 2011-05-16 14:23
Re: How to use TagItem in TDR_EasyStruct ...
You should report this as a bug. For easy direct comparison I created this little test case:
  1. /* */
  2.  
  3. /*----------------------------------------------------------------------------*/
  4. /* */
  5. /*----------------------------------------------------------------------------*/
  6.  
  7. #include <proto/exec.h>
  8. #include <proto/dos.h>
  9. #include <proto/intuition.h>
  10.  
  11. /*--------------------------------------------------------------------------*/
  12. /* */
  13. /*--------------------------------------------------------------------------*/
  14.  
  15. long RequestChoice (struct Window *win,const char *title,const char *body,const char *gadgets)
  16.  
  17. {
  18. long result;
  19. struct EasyStruct es;
  20. ULONG idcmp = 0;
  21. struct TagItem es_tags[] = {{ESA_Position,REQPOS_CENTERWINDOW},{TAG_END}};
  22.  
  23. es.es_StructSize = sizeof(struct EasyStruct);
  24. es.es_Flags = ESF_TAGGED;
  25. es.es_Title = (STRPTR)title;
  26. es.es_TextFormat = (STRPTR)body;
  27. es.es_GadgetFormat = (STRPTR)gadgets;
  28. es.es_TagList = es_tags;
  29.  
  30. result = EasyRequest (win,&es,&idcmp,TAG_END);
  31. /*
  32. result = TimedDosRequesterTags (
  33. TDR_Window,win,
  34. TDR_EasyStruct,&es,
  35. TDR_IDCMP_Ptr,&idcmp,
  36. TAG_END);
  37. */
  38. return (result);
  39. }
  40.  
  41. /*----------------------------------------------------------------------------*/
  42. /* */
  43. /*----------------------------------------------------------------------------*/
  44.  
  45. int main (void)
  46.  
  47. {
  48. struct Window *win;
  49.  
  50. if ((win = OpenWindowTags (NULL,
  51. WA_Left,604,
  52. WA_Top,448,
  53. WA_Width,400,
  54. WA_Height,300,
  55. WA_Title,"Test",
  56. WA_Flags,WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_NOCAREREFRESH,
  57. TAG_END)))
  58. {
  59.  
  60. RequestChoice (win,"Requester","This is a test","Ok");
  61.  
  62. CloseWindow (win);
  63. }
  64.  
  65. return (0);
  66. }
  67.  
  68. /*----------------------------------------------------------------------------*/
  69. /* */
  70. /*----------------------------------------------------------------------------*/
It works with EasyRequest but not with TimedDosRequester. The latter is always centered on the screen, not on the window.
salass00
salass00's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-02-03 11:27
Re: How to use TagItem in TDR_EasyStruct ...
First off any unused fields of the EasyStruct structure should be set to zero rather than left undefined. This can be done with "ClearMem(&es, sizeof(es));" before any other initialisation is done. Also try setting TDR_NonBlocking to TRUE in your TimedDosRequesterTags() call. If it works better this way then it's simply a missing feature in the IPrefs patched version of this function.
mritter0
mritter0's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 2014-04-21 21:15
Re: How to use TagItem in TDR_EasyStruct ...
Just for testing sake, WPOS_CENTERWINDOW AND WPOS_CENTERSCREEN were reversed in a much older SDK. Try using REQPOS_CENTERSCREEN to see if they are reversed, too.
jabirulo
jabirulo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2013-05-30 00:53
Re: How to use TagItem in TDR_EasyStruct ...
ok, adding ClearMem() and TDR_NonBlocking then shows requester centered on window (with REQPOS_CENTERWINDOW), but without all the eyecandy (no TDR_ImageType,TDRIMAGE_ERROR is used and buttons look '_Cancel' & 'C_ontinue' not underscored). So it's iPrefs bug then? TIA
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
salass00
salass00's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-02-03 11:27
Re: How to use TagItem in TDR_EasyStruct ...
@jabirulo
So it's iPrefs bug then?
No, just a missing feature as I said before. IPrefs patches TimedDosRequester() to use the ReAction "requester.class" when possible. The "requester.class" however from what I can see places the requester according to GUI/screen settings and allows no way of overriding this for a specific requester only.
jabirulo
jabirulo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2013-05-30 00:53
Re: How to use TagItem in TDR_EasyStruct ...
Ok, I got the impression that 'missing feature' meant it should work but coders forgot to add code to iprefs. Shame, 'cos was a nice option could be nice on some cases.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Log in or register to post comments