On 26 Oct 2003 at 20:51, P Witte wrote:
>
> Sorry for being
such a pain, but I have some further questions:
>
> How do I position
a PE window accurately? Problem is, I want to create a
> button, to go
into the button frame. Im hoping to use a standard Window
> Definition with
a single Loose Item. If I use a window with a border width
> of 1 and then
use wm.prpos, my button overlaps part of the adjacent button.
> (This occurs
even when my button's x-origen is divisible by 4). If I use a
> borderless window,
ie border width 0, there is no problem,
Does the software have to be able
to run on a machine that may NOT have the menu
extensions installed?
If not I suggest you use the menu
extensions to set up your button.
(I could help you there)
if not, I've dug up some old code
I hd used previously for a button with a
standard border
(A4 = working definition)
MOVE.L $20(A4),D7 ; D7= window size
MOVEM.L A0/A4,-(A7)
MOVEQ #0,D0
TRAP #1
; get sys vars
ADD.L #$B8,A0 ; point to thing list
bflp2 MOVE.L
(A0),D1 ; next pointer
BEQ.S th_fou ; if 0, this should be
THING
MOVE.L D1,A0
BRA.S bflp2
th_fou MOVE.L $10(A0),A0
CMP.L #-1,4(A0) ; is it OK?
BNE.S thnf1 ; no, there are
no things!
MOVEQ #$28,D0 ; preset use call
MOVEQ #-1,D1
MOVE.L 8(A0),A2 ; thing vector
LEA bfr_name,A0 ; point to thing name
MOVE.L A2,D6 ; D6= THING VECTOR
MOVE.L D7,D2 ; wdw size
MOVEQ #0,D3 ; new allocation
ADD.L #$20002,D2 ; prepare for border!
JSR (A2) ;
use this thing (return orig in D2)
MOVEM.L (A7)+,A0/A4
MOVE.L D0,D7 ; as of here: D7: flag
whether in BF
BNE.S thnf2 ; did we use it
alright?
ADD.L #$20001,D2 ; adjust origin for border
ADD.L $24(A4),D2 ; and set to origin of wdw now
MOVE.L D2,D1
BRA.S bfsuite1
thnf1 MOVEM.L (A7)+,A0/A4
; this is used if thing not used
thnf2 LEA
butx,A2
MOVE.L (A2),D1
bfsuite1 JSR
$C(A5) ; position
JSR $1C(A5) ; and draw
except as below:
> In certain circumstances,
I want to be able to liberate the button from the
> Button Frame
and then, after doing whatever to it, put it back again
> (automatically,
ie not using wm.chwin). wm.prpos makes it jump all over
> the place!
I'm not sure I understand your problem
- what jumps all over the palce?
I presume it is not the button, but
your "normal" wdw.
If that is so, here is the code I
use for that in some of my programs:
It presumes that A4 points to the
working definition
setbtn MOVEQ #-1,D2
; use pointer position for button
BSR do_butn ; use button thing
etc
; we come back here after the user
clicked on the button, the button wdw
; and definition are gone, so is the
screen channel
; A4 points to my old working definition
LEA chan,A0 ; simple 'con' definition
MOVEQ #1,D0
MOVEQ #-1,D1
MOVEQ #0,D3
TRAP #2
; open it
TST.L D0
BNE bye ;
what?
MOVE.L A0,8(A4) ; channel ID into working definition
MOVE.L #0,getdir(A4) ; just in case
LEA status(A4),A1 ; OLD status area, should have remained unchanged
MOVE.L $20(A1),D1 ; absolute ptr position when we left this wdw
SUB.L $24(A4),D1 ; make new origin of wdw...
MOVE.L D1,$24(A4) ; ...now
MOVE.L $20(A1),D1 ; and reset wdw at exact same position
JSR wm.prpos(A5) ; position wdw
JMP wm.wdraw(A5) ; draw & return
(yes I know, I should optimize this
by putting D1 into another register to save a memory
access)
> Ive spent ages
trying various alternatives. Please help!
I hope this does.
Wolfgang
-------------------------------------
www.scp-paulet-lenerz.com
