CompuServe Thread

#Window active help

10 messages in this thread
#160From: Jim VogelJul 12, 1988 9:58 PM
Does anyone know f\how to activate a window from inside a program…I.e. not using the mouse :^). I have two windows, opened on a custom screen, one of which I want to allways be active. So if someone clicks onthe other window, I need to deactivate that window, and activate the original one. I suspect I can do it by altering the window.Flags paramater for each window; but I am not sure how to do this, or if this is the best way. would window.Flags = (window.Flags | ACTIVATE) work? Any suggestions would be Jim Vogel
#162From: Martin MurrayJul 12, 1988 10:01 PM
There is an ActivateWindow(window) function. Try that. -Martin Murray
#167From: Jim VogelJul 12, 1988 10:51 PM
Martin, Yes, I discovered that soon after I left this message. I have a V1.1 RKM, and ActiveateWindow is a V1.2 call. That will teach me not to update my manuals :^) Thanks, Jim Vogel
#164From: Black Belt SystemsJul 12, 1988 10:08 PM
First, set ACTIVEWINDOW and INACTIVEWINDOW for btoh (all) windows. Next, keep a (set of) flag(s) that indicate which window YOU want to be active. When you get messages that indicate things aren't the way your internal flags say they SHOULD be, call ActivateWindow with the pointer to the window YOU want active. UNfortunately…. Our freinds at CBM have "bugged" us on this one. the ACTIVEWINDOW and INACTIVEWINDOW messages don't appear when you press the front or back gadgets of a window – the user can activate the "quietly", without your knowledge. Your only option IS to sit and watch the state of the window.flag variable, unless you accept that they can mess you up. Here's one workaround (I use it): Set raw keys (or whatever else) in the window you DONT want active… if the user activates it, and inadvertantly types something, then you get a message… which you can them hum over to the window YOU wanted active, at the same time deactivating the "wrong" window. The _real_ bad news is that CBM & crew don't plan to fix any intuition bugs till 1.4 and since 1.3 is still the stuff of myth…. well, YOU figure it out. –Ben–
#169From: Jim VogelJul 12, 1988 10:55 PM
Ben, Ok thanks , I think I will check the way you said. that should work ok. Jim Vogel
#171From: Vic WagnerJul 12, 1988 11:00 PM
Ben, I have a small program, which I've uploaded here before: called 'swindow'. It does NOT show the symptom of 'missing' activate window messages. /^o^\
#195From: Black Belt SystemsJul 13, 1988 10:28 AM
No, huh…. hmmm. That's very interesting. Using 1.2? 1.3? version? How many windows does it have? The symptoms I'm describing occurs with multiple windows in one program… which is what he wants to do, I think. –Ben–
#170From: Vic WagnerJul 12, 1988 10:59 PM
I understand the desire to have the other window active, it looks nice without the title bar ghosted and all that. Why is is NECCESARY however? /^o^\
#173From: Jim VogelJul 13, 1988 12:41 AM
Vic, I have two windows, called pic and text. Pic is 320X100, and is used to only display the pictures, using DrawImage. Text is 320X200, and has the console device opened to it. I want to be able to have depth and close gadtes in both windows, but the console device opened up in only one. If someone accidently selects pic, or uses the depth gadgets to put pic in back, I still want to wake up for console msgs coming into text. However, if someone activated pic, then I WON'T get those msgs until the person reactivate's text. I guess what Ireally want is for pic to NEVER be active, and to only do depth and close window. I tried the below code, but never got a INACTIVEWINDOW event for text. Can you see anything that would keep it from working? #define TIFLAGS CLOSEWINDOW | INACTIVEWINDOW | ACTIVEWINDOW #define PIFLAGS CLOSEWINDOW | ACTIVEWINDOW #define TWFLAGS WINDOWCLOSE | WINDOWDEPTH | SMART_REFRESH | NOCAREREFRESH \ | ACTIVATE #define PWFLAGS WINDOWCLOSE | WINDOWDEPTH | SMART_REFRESH | NOCAREREFRESH wakeUpSig = Wait(textIntuiSig | picIntuiSig | conReadSig); if (wakeUpSig == textIntuiSig) { message = (struct IntuiMessage *) GetMsg(textwin->UserPort); if(message != NULL) { class = message->Class; code = message->Code; ReplyMsg((struct Message *)message); } /* if*/ switch(class){ case CLOSEWINDOW: DoCloseUp(); exit(1); case INACTIVEWINDOW: printf("text window inactive\n"); if ((1 << WINDOWACTIVE) & picwin->Flags) ActivateWindow(textwin); break; case ACTIVEWINDOW: printf("text window active\n"); break; } /* switch */ } /* if */ else if (wakeUpSig == picIntuiSig) { message = (struct IntuiMessage *) GetMsg(picwin->UserPort); if(message != NULL) { class = message->Class; code = message->Code; ReplyMsg((struct Message *)message); } /* if*/ switch(class){ case CLOSEWINDOW: DoCloseUp(); exit(1); case ACTIVEWINDOW: ****** MORE *****
#174From: Jim VogelJul 13, 1988 12:43 AM
printf("pic window active\n"); ActivateWindow(textwin); break; } /* switch */ I have another "fix" if this does not work. That is to make pic a borderless window, setit at 0,11 instead of 0,0, and get rid of its close and depth gadgets. Then I can still test to see if it is active, and if so , activate text. This eliminates the need to have depth , and close gadgets in pic. Any suggestions or comments? Thanks, Jim Vogel