Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6574 > unrolled thread

End Drag and Wimp_SendMessage 18 DataSave

Started byPaul Stewart <phorefaux@gmail.com>
First post2025-12-20 22:32 +0000
Last post2025-12-29 15:53 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  End Drag and Wimp_SendMessage 18 DataSave Paul Stewart <phorefaux@gmail.com> - 2025-12-20 22:32 +0000
    Re: End Drag and Wimp_SendMessage 18 DataSave Matthew Phillips <spam2011m@yahoo.co.uk> - 2025-12-21 21:53 +0000
      Re: End Drag and Wimp_SendMessage 18 DataSave Matthew Phillips <spam2011m@yahoo.co.uk> - 2025-12-21 21:58 +0000
      Re: End Drag and Wimp_SendMessage 18 DataSave Paul Stewart <phorefaux@gmail.com> - 2025-12-29 15:53 +0000

#6574 — End Drag and Wimp_SendMessage 18 DataSave

FromPaul Stewart <phorefaux@gmail.com>
Date2025-12-20 22:32 +0000
SubjectEnd Drag and Wimp_SendMessage 18 DataSave
Message-ID<a772638e5c.Paul@phorefaux>
Hi guys,

Hoping someone can point out where I'm going wrong!

Having slight issue with Wimp_SendMessage DataSave.
Trying to do a save window.
I have created my save window and done the drag to filer window okay.  I'm 
able to drag to the filer window and release.
Getting stuck after I go into my end drag routine.
Not getting any error messages, everything looks like it is working okay, 
but having called SYS"Wimp_SendMessage",18 at end of the procedure, 
nothing happens!
Returns to my poll loop but not generating event 18 for me to then move 
onto the next bit.  The procedure is completing and returning to the poll 
loop.

Here is both my Poll loop and the end drag routines.  Hoping someone can 
point out where I've messed up.

DEF PROCpoll
    SYS "Wimp_Poll",,b% TO r%
    CASE r% OF
        WHEN 2: SYS "Wimp_OpenWindow",,b%
        WHEN 3: SYS "Wimp_CloseWindow",,b%
                CASE b%!0 OF
                     WHEN wh_main%: quit%=TRUE
                     WHEN wh_fwhosts%: PROCicon_deleteallicons(b%!0)
                     WHEN 
wh_fwdiscs%:wh%=wh_main%:PROCicon_deleteallicons(b%!0)
                     WHEN wh_fwhostdiscs%:PROCicon_deleteallicons(b%!0)
                ENDCASE
        WHEN 6: PROCmouse_click
        WHEN 7: PROCmouse_drag_end
        WHEN 9: PROCmenu_click
        WHEN 17,18: PROCreceive
    ENDCASE
ENDPROC
:
DEF PROCmouse_drag_end
    SYS "Wimp_GetPointerInfo",,b%
    b%!20=b%!12:REM destination window handle
    b%!24=b%!16:REM destination icon handle
    b%!28=b%!0:REM destination x coordinate
    b%!32=b%!4:REM destination y coordinate
    b%!36=1024
    b%!40=&DFE
    a$=$savestr%+CHR$0:REM get leafname
    $(b%+44)=a$:REM leafname of file
    !b%=44+((LEN a$) DIV 4)*4:REM length of block
    IF LEN a$ MOD 4<>0 THEN !b%+=4
    b%!12=0:REM your_ref for original message
    b%!16=1:REM Message_DataSave
    b%!8=0
    b%!4=task%
    SYS"Wimp_SendMessage",18,b%,b%!20,b%!24
ENDPROC



-- 
Paul Stewart
Sent from A9home running RISC OS 4.42

[toc] | [next] | [standalone]


#6576

FromMatthew Phillips <spam2011m@yahoo.co.uk>
Date2025-12-21 21:53 +0000
Message-ID<33b8e38e5c.Matthew@sinenomine.co.uk>
In reply to#6574
In message <a772638e5c.Paul@phorefaux>
 on 20 Dec 2025 Paul Stewart  wrote:

> Hi guys,

> Hoping someone can point out where I'm going wrong!

> Having slight issue with Wimp_SendMessage DataSave.
> Trying to do a save window.
> I have created my save window and done the drag to filer window okay.  I'm
> able to drag to the filer window and release.
> Getting stuck after I go into my end drag routine.
> Not getting any error messages, everything looks like it is working okay,
> but having called SYS"Wimp_SendMessage",18 at end of the procedure,
> nothing happens!
> Returns to my poll loop but not generating event 18 for me to then move
> onto the next bit.  The procedure is completing and returning to the poll
> loop.

> Here is both my Poll loop and the end drag routines.  Hoping someone can
> point out where I've messed up.

> DEF PROCpoll
>     SYS "Wimp_Poll",,b% TO r%
>     CASE r% OF
>         WHEN 2: SYS "Wimp_OpenWindow",,b%
>         WHEN 3: SYS "Wimp_CloseWindow",,b%
>                 CASE b%!0 OF
>                      WHEN wh_main%: quit%=TRUE
>                      WHEN wh_fwhosts%: PROCicon_deleteallicons(b%!0)
>                      WHEN
> wh_fwdiscs%:wh%=wh_main%:PROCicon_deleteallicons(b%!0)
>                      WHEN wh_fwhostdiscs%:PROCicon_deleteallicons(b%!0)
>                 ENDCASE
>         WHEN 6: PROCmouse_click
>         WHEN 7: PROCmouse_drag_end
>         WHEN 9: PROCmenu_click
>         WHEN 17,18: PROCreceive
>     ENDCASE
> ENDPROC
>:
> DEF PROCmouse_drag_end
>     SYS "Wimp_GetPointerInfo",,b%
>     b%!20=b%!12:REM destination window handle
>     b%!24=b%!16:REM destination icon handle
>     b%!28=b%!0:REM destination x coordinate
>     b%!32=b%!4:REM destination y coordinate
>     b%!36=1024
>     b%!40=&DFE
>     a$=$savestr%+CHR$0:REM get leafname
>     $(b%+44)=a$:REM leafname of file
>     !b%=44+((LEN a$) DIV 4)*4:REM length of block
>     IF LEN a$ MOD 4<>0 THEN !b%+=4
>     b%!12=0:REM your_ref for original message
>     b%!16=1:REM Message_DataSave
>     b%!8=0
>     b%!4=task%
>     SYS"Wimp_SendMessage",18,b%,b%!20,b%!24
> ENDPROC

I cannot see anything immediately wrong with your code, but it's possible 
that the replies are not being passed back to you because of how you have 
registered with the Wimp.

When you called Wimp_Initialise, what version number did you declare in 
R0, and did you include in R3 a pointer to a list of user messages that 
you are interested in?  You need to make sure that not only any messages 
you expect to receive are listed here, but also any messages you expect to 
send recorded (18) because to detect any bounce-backs via Wimp event code 
19 you will need to be accepting the user message you have just sent.

You can set R3 to point to a block where the first word is zero if you 
want to receive all user messages.  This will make your application less 
efficient, but it can be a good way of working out what the cause of the 
problem is.

I would also strongly recommend that you download and learn how to use a 
Wimp message monitoring application like WimpMon by Tom Hughes or the 
MsgMon module by Steve Fryatt (https://stevefryatt.org.uk/risc-os/msgmon).
These can tell you the contents of all messages being received by any 
application on the computer, and they are invaluable for debugging.  Note 
that only messages that the Wimp has passed to an application are 
reported, though, so if an application has indicated that it does not need 
to receive certain messages, the monitoring tools will not show them 
either.

Hope that helps you get a bit further.

-- 
Matthew Phillips
Durham

[toc] | [prev] | [next] | [standalone]


#6577

FromMatthew Phillips <spam2011m@yahoo.co.uk>
Date2025-12-21 21:58 +0000
Message-ID<272ae48e5c.Matthew@sinenomine.co.uk>
In reply to#6576
In message <33b8e38e5c.Matthew@sinenomine.co.uk>
 on 21 Dec 2025 Matthew Phillips  wrote:

> In message <a772638e5c.Paul@phorefaux>
>  on 20 Dec 2025 Paul Stewart  wrote:

>> DEF PROCmouse_drag_end
>>     SYS "Wimp_GetPointerInfo",,b%
>>     b%!20=b%!12:REM destination window handle
>>     b%!24=b%!16:REM destination icon handle
>>     b%!28=b%!0:REM destination x coordinate
>>     b%!32=b%!4:REM destination y coordinate
>>     b%!36=1024
>>     b%!40=&DFE
>>     a$=$savestr%+CHR$0:REM get leafname
>>     $(b%+44)=a$:REM leafname of file
>>     !b%=44+((LEN a$) DIV 4)*4:REM length of block
>>     IF LEN a$ MOD 4<>0 THEN !b%+=4
>>     b%!12=0:REM your_ref for original message
>>     b%!16=1:REM Message_DataSave
>>     b%!8=0
>>     b%!4=task%
>>     SYS"Wimp_SendMessage",18,b%,b%!20,b%!24
>> ENDPROC

> I cannot see anything immediately wrong with your code, but it's possible
> that the replies are not being passed back to you because of how you have
> registered with the Wimp.

P.S. you may want to consider whether you want the application to send a 
message to itself, if the user drops the icon back on the save window or 
on another window belonging to your application.  Sometimes it is 
perfectly justified sending a message to yourself: it can make handling 
things like saving from an editor window and dropping the content into 
another editor window easier.  But there are likely to be cases where you 
do not want to generate a message to your own application.  Just something 
to think about, and, indeed, to test.

-- 
Matthew Phillips
Durham

[toc] | [prev] | [next] | [standalone]


#6580

FromPaul Stewart <phorefaux@gmail.com>
Date2025-12-29 15:53 +0000
Message-ID<ef79e1925c.Paul@phorefaux>
In reply to#6576
In message <33b8e38e5c.Matthew@sinenomine.co.uk>
          Matthew Phillips <spam2011m@yahoo.co.uk> wrote:

> In message <a772638e5c.Paul@phorefaux>
>  on 20 Dec 2025 Paul Stewart  wrote:

>> Hi guys,

>> Hoping someone can point out where I'm going wrong!

>> Having slight issue with Wimp_SendMessage DataSave.
>> Trying to do a save window.
>> I have created my save window and done the drag to filer window okay.  I'm
>> able to drag to the filer window and release.
>> Getting stuck after I go into my end drag routine.
>> Not getting any error messages, everything looks like it is working okay,
>> but having called SYS"Wimp_SendMessage",18 at end of the procedure,
>> nothing happens!
>> Returns to my poll loop but not generating event 18 for me to then move
>> onto the next bit.  The procedure is completing and returning to the poll
>> loop.

>> Here is both my Poll loop and the end drag routines.  Hoping someone can
>> point out where I've messed up.

>> DEF PROCpoll
>>     SYS "Wimp_Poll",,b% TO r%
>>     CASE r% OF
>>         WHEN 2: SYS "Wimp_OpenWindow",,b%
>>         WHEN 3: SYS "Wimp_CloseWindow",,b%
>>                 CASE b%!0 OF
>>                      WHEN wh_main%: quit%=TRUE
>>                      WHEN wh_fwhosts%: PROCicon_deleteallicons(b%!0)
>>                      WHEN
>> wh_fwdiscs%:wh%=wh_main%:PROCicon_deleteallicons(b%!0)
>>                      WHEN wh_fwhostdiscs%:PROCicon_deleteallicons(b%!0)
>>                 ENDCASE
>>         WHEN 6: PROCmouse_click
>>         WHEN 7: PROCmouse_drag_end
>>         WHEN 9: PROCmenu_click
>>         WHEN 17,18: PROCreceive
>>     ENDCASE
>> ENDPROC
>>:
>> DEF PROCmouse_drag_end
>>     SYS "Wimp_GetPointerInfo",,b%
>>     b%!20=b%!12:REM destination window handle
>>     b%!24=b%!16:REM destination icon handle
>>     b%!28=b%!0:REM destination x coordinate
>>     b%!32=b%!4:REM destination y coordinate
>>     b%!36=1024
>>     b%!40=&DFE
>>     a$=$savestr%+CHR$0:REM get leafname
>>     $(b%+44)=a$:REM leafname of file
>>     !b%=44+((LEN a$) DIV 4)*4:REM length of block
>>     IF LEN a$ MOD 4<>0 THEN !b%+=4
>>     b%!12=0:REM your_ref for original message
>>     b%!16=1:REM Message_DataSave
>>     b%!8=0
>>     b%!4=task%
>>     SYS"Wimp_SendMessage",18,b%,b%!20,b%!24
>> ENDPROC

> I cannot see anything immediately wrong with your code, but it's possible
> that the replies are not being passed back to you because of how you have
> registered with the Wimp.

Thanks very much.  Indeed, Wimp_Initialse was the issue.

-- 
Paul Stewart
Sent from A9home running RISC OS 4.42

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web