Setting of tag WINDOW_FrontBack fails

3 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2010-11-30 14:09
Setting of tag WINDOW_FrontBack fails

Hi,

I'm using this hook function in order to cope with a.o. changes in a window's position, beit in vertical or horizontal direction or in depth. The latter one gives me problems.

The situation is as follows:
From a main window (= mother, indexed by WOID_MAIN) I open a second window (= daughter, indexed by WOID_TASK). Daugther should ALWAYS be in the middle of mother and always be in front of mother and always be the active one. However, whatever I do there is an unacceptable great chance that daughter gets BEHIND mother and is therefore no longer reachable.

The pairn of tags: , WINDOW_Position , ((uint32)WPOS_CENTERWINDOW) is commented out as it does not work (?). Tags WA_Left and WA_Top have taken over and DO give the desired results, as does WA_Activate. So far so good. The final tag, WINDOW_FrontBack gives offence and Result is set to 4 indicating this to be the offending tag.
Rest assured that WINDOW_RefWindow has been set to the motherwindow (and not object).

  1. /*
  2. **
  3. ** IDCMPHook.c
  4. **
  5. ** tjitte de wolff
  6. **
  7. ** Feb 17,2021
  8. **
  9. ***********************/
  10.  
  11. #define ___GD ((struct GUI_Data *)((struct GUI_Elements *)((struct ExecParam *)hk->h_Data)->xn_GUI_Elements)->ge_GUI_Data)
  12. #define ___GE ((struct GUI_Elements *)((struct ExecParam *)hk->h_Data)->xn_GUI_Elements)
  13. #define ___ALIGN_LEFT(Mother, Daughter) ___GE->ge_Window[Mother]->LeftEdge + ((___GE->ge_Window[Mother ]->Width - \
  14.   ___GE->ge_Window[Daughter]->Width) >> 1)
  15.  
  16. #define ___ALIGN_TOP(Mother , Daughter) ___GE->ge_Window[Mother]->TopEdge + ((___GE->ge_Window[Mother ]->Height - \
  17.   ___GE->ge_Window[Daughter]->Height) >> 1)
  18.  
  19.  
  20.  
  21. uint32 IDCMPHook(struct Hook *hk UNUSED, APTR Window, struct IntuiMessage *imsg)
  22. {
  23. uint32 RC = 0;
  24.  
  25. IExec->DebugPrintF("INFO : Message Class [ %08lx ] \n", imsg->Class);
  26.  
  27. switch (imsg->Class)
  28. {
  29. case IDCMP_CHANGEWINDOW:
  30. {
  31. if (___GE->ge_ActiveWOID != WOID_MAIN)
  32. {
  33. uint32 Result = IIntuition->SetWindowAttrs(___GE->ge_Window[___GE->ge_ActiveWOID]//, WINDOW_Position , ((uint32)WPOS_CENTERWINDOW)
  34. , WA_Left , ((uint32)___ALIGN_LEFT(WOID_MAIN, WOID_TASK))
  35. , WA_Top , ((uint32)___ALIGN_TOP(WOID_MAIN, WOID_TASK))
  36. , WA_Activate , ((uint32)TRUE)
  37. , WINDOW_FrontBack, ((uint32)WT_FRONT)
  38. , TAG_END);
  39.  
  40. IExec->DebugPrintF("INFO : Result was [ %lu ( = %s )]\n", Result, (Result == 0) ? ("OK") : ("Tsk, tsk, tsk"));
  41. }
  42.  
  43. break;
  44. }
  45.  
  46.  
  47. case IDCMP_MOUSEMOVE:
  48. {
  49. if (
  50. (((struct Window *)Window)->MouseY > ((struct Window *)Window)->TopEdge) &&
  51. (((struct Window *)Window)->MouseY < (((struct Window *)Window)->TopEdge + ((struct Window *)Window)->Height)) &&
  52.  
  53. (((struct Window *)Window)->MouseX > ((struct Window *)Window)->LeftEdge) &&
  54. (((struct Window *)Window)->MouseX < (((struct Window *)Window)->LeftEdge + ((struct Window *)Window)->Width))
  55. )
  56. {
  57. ___GD->gd_Suspend = TRUE;
  58. }
  59. else
  60. {
  61. ___GD->gd_Suspend = FALSE;
  62. }
  63.  
  64. break;
  65. }
  66. }
  67.  
  68. return RC;
  69. }
  70.  
  71. /*
  72. ** ================================================================================================
  73. ** === End of File ================================================================================
  74. ** ================================================================================================
  75. */

My question is: what could possibly make ', WINDOW_FrontBack, ((uint32)WT_FRONT)' fail?

OldFart

thomas
thomas's picture
Offline
Last seen: 1 week 20 hours ago
Joined: 2011-05-16 14:23
Re: Setting of tag WINDOW_FrontBack fails

You are mixing up ReAction and Intuiton.

WINDOW_#? attributes are those of a ReAction window.class object.

WA_#? attributes are those of an Intuition window.

SetWindowAttrs can only set attributes of Intuition windows, i.e. WA_#? attributes.

To change WINDOW_#? attributes you have to use IIntuition->SetAttrs on the window.class object.

To be honest, nailing one window to another one is not AmigaOS-like. The way to go to have part of a window hidden by another window-like thing is using a Requester. But I doubt that the AmigaOS concept of requesters works nicely with ReAction. At least I never tried it.

IMHO this "feature" is one of the most annoying things in MS Windows and trying to copy it in AmigaOS will make the application be a bad one. Open the second window in the middle of the first one and then let the user move them independently.

MobileConnect
MobileConnect's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2021-03-08 19:05
Re: Setting of tag WINDOW_FrontBack fails

The only app i know that glues multiple windows together is AmigaAMP, to be honest although i think it's not a great UX, I have always been impressed how they pulled it off flawlessly.

Log in or register to post comments