Morning all, I've written a small demo program to show the things that happen when an application sub-window is hit in a PE program. The program has a window containing a single application sub-window.
The hit routine does nothing more than this: ahit0 movem.l d1/d3/d5-d7/a0/a4,-(a7) ; Save the workers moveq #0,d1 ; D1.W = Application sub window number moveq #0,d2 ; D2.W = Ink colour ; A4 already set to Working definition jsr wm_swapp(a2) ; Set channel id (A0) to the subwindow movem.l a1-a2,-(a7) ; A1 gets corrupted lea hit,a1 ; Text string to print move.w ut_mtext,a2 ; Print string vector jsr (a2) ; Print the message lea hitter,a1 ; Hit counter location move.w (a1),d1 ; Hit counter value addq.w #1,d1 ; Increment counter move.w d1,(a1) ; Save counter move.w ut_mint,a2 ; Print integer vector jsr (a2) ; Print it movem.l (a7)+,a1-a2 ; Restore movem.l (a7)+,d1/d3/d5-d7/a0/a4 ; Restore the workers moveq #0,d0 ; No errors rts ; Strings and things go here hitter dc.w 0 ; How many times have I been hit? hit dc.w hit_e-hit-2 ; Hit message dc.b 'HIT: ' hit_e equ * Now, when run I notice the following "foibles": 1. The hit code is called when the pointer enters the sub-window, and each time it moves within the sub-window. 2. Pressing the TAB key, which activates the sub-window, the counter increases by TWO and not one. 3. Pressing the F1 key also increases the count by two. 4. Other keys, I have not tested everything, increment the counter by one. There are no menus or anything in the sub-window, it is used simply as a display area by the program, aub-window menus come in a later article! Another question, I only have a single sub-window. If I comment out the call to WM_SWAPP in the hit routine, I still see my output in the sub-window, but it is not cleared before hand. (I can live with this) but when I was writing PE stuff using SuperBasic and EasyPTR 3, I always had to set the channel to the sub-window (or info window or whatever) before I could write to it. So, My further queries are: 1. Do I need to call WM_SWAPP if I only have one sub-window or can I assume that the channel id always refers to the sub-window regardless unless I explicitly set it to a loose item or whatever? 2. If I have two or more sub-windows, does the channel id, by default, point at the first - I haven't tested this yet - If I don't call WM_SWAPP? Thanks. PS. The above has been noticed running on QPC under Wine on Linux. I'm attempting to run it under Windows (in an emulator) to see what happens there! -- Norman Dunbar Dunbar IT Consultants Ltd Registered address: Thorpe House 61 Richardshaw Lane Pudsey West Yorkshire United Kingdom LS28 7EL Company Number: 05132767 _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm