home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1994-11-27 | 6.2 KB | 190 lines |
- >Wimp
- : Typical wimp library routine examples for BasCompress
- C Note that use
- eval() rather than
- . This is a simple routine
- ? that, depending on a debugging variable, traps any errors.
- Query ONLY brought up by PROC_Stop_Action, this routine called when
- main wimp poll detected a mouse click inside the Query window.
- _Mouse_Click_Query(x%, y%, b%, icon%)
- _Cancel_Stop
- H x% =
- eval("FN_Stop_Action_"+ query_action$+ "("+
- (icon%=0)+ ")")
- _Stop_Action_(pressed_YES%)
- _Wimp_Error(Wimp_Error_Fatal%, "Illegal click in unclaimed query window")
- _Load_Template_Extra(id$, rove%, sprite_pointer%, routine$)
- result%, r0%, C%
- & $template_name% = id$+ "*"+
- "XWimp_LoadTemplate",, template_file%, rove%, inddata_end%, -1, template_name%, 0
- r0%,, indrove%; C%
- _PSR_V_Set(C%)
- _Wimp_Error_Block(r0%)
- _Wimp_CloseDown
- getname(template_name%)<>id$
- +
- _Set_Message_String("Reason", id$)
- 2
- _Wimp_Error(Wimp_Error_Fatal%,
- LEMsg(3))
- _Wimp_CloseDown
- !) template_file%!64 = sprite_pointer%
- routine$<>""
- eval("FN"+ routine$)
- "Wimp_CreateWindow",, template_file%
- result%
- = result%
- Called from main wimp poll loop
- Allow multiple routines
- _Null_Reason_Code
- n%, r$
- n% = n_null%
- n%>0
- n% -= 1
- r$ = null_q$(n%)
- r$<>Null$
- 0*
- eval("FN_Null_Reason_"+ r$)
- 1"
- null_q$(n%)<>Null$
- n_null% -= 1
-
-
- 5
- _User_Drag_Box
- <) x% =
- eval("FN_Dragged_"+ dragged$)
- dragged_button%<>(1*16)
- _Close_All_Menus
- "Wimp_DragBox",, -1 : dragged$ = ""
- *********************************************************************
- This can be used to drag anything
- When the pointer leaves the window the window's scrolled in the
- opposite direction
- w% window
- b% current mouse buttons
- type% type of drag to perform (5, 6, or 7)
- xmin...ymax% box to drag (screen)
- Xmin...Ymax% parent box (screen)
- Wxmin..Wxmax% windows' work area extent, (0=>find out)
- routine$ call FN_Dragged_<routine$> at end
- _DragBoxScrollWindow(w%, b%, type%, xmin%, ymin%, xmax%, ymax%, Xmin%, Ymin%, Xmax%, Ymax%, Wxmin%, Wymin%, Wxmax%, Wymax%, routine$)
- P%, l%
- l% = 64
- P% =
- _Claim_Stack(l%)
- P%!00 = type%
- P%!04 = xmin%
- P%!08 = ymin%
- P%!12 = xmax%
- P%!16 = ymax%
- P%!20 = Xmin%
- P%!24 = Ymin%
- P%!28 = Xmax%
- P%!32 = Ymax%
- P%!36 = Wxmin%
- P%!40 = Wymin%
- P%!44 = Wxmax%
- P%!48 = Wymax%
- "CAssembler_Window", Window_DragBoxScroll, w%, P%
- b) dragged_BoxScrollWindow$ = routine$
- c2 dragged$ = "BoxScrollWindow"
- d# dragged_button% = b%
- _Release_Stack(P%, l%)
- _Dragged_BoxScrollWindow
- eval("FN_Dragged_"+ dragged_BoxScrollWindow$)
- *********************************************************************
- This can be used to drag a window about, usually dragging "background"
- It will scroll in the direction the mouse moves in
- w% window
- b% current mouse buttons
- x%, y% current mouse x, y
- xmin..ymax% windows' work area extent, (0=>find out)
- routine$ call FN_Dragged_<routine$> at end
- _DragScrollWindow(w%,b%, x%,y%, xmin%,ymin%,xmax%,ymax%, routine$)
- "CAssembler_Window",Window_DragScroll,w%,x%,y%,xmin%,ymin%,xmax%,ymax%
- w' dragged_ScrollWindow$ = routine$
- x- dragged$ = "ScrollWindow"
- y! dragged_button% = b%
- _Dragged_ScrollWindow
- dragged_ScrollWindow$<>""
- ~5
- eval("FN_Dragged_"+ dragged_ScrollWindow$)
- _Message_RAM_Transmit
- W%!12<>RAM_Load_Ref%
- _Wimp_Error(Wimp_Error%, "Unexpected RAM_Transmit message")
- H RAM_Load_Size% += W%!24 :
- #bytes transfered
- (W%!24)=RAM_Load_Buffer_Length%
- @
- _RAM_Load :
- Ask for more
- :
- A :
- Buffer not full, so all loaded - end communications
- :
- Z
- eval("FN_RAM_Load_Completed_"+ RAM_Load_Routine$+ "("+
- (RAM_Load_Size%)+")")
-
- _Wimp_LError(6)
-
- Called to request that the application reserve some memory for more
- of a file to be loaded via the RAM transfer protocol
- _RAM_Load
- RAM_start%
- eval("FN_RAM_Load_"+ RAM_Load_Routine$+ "("+
- (RAM_Load_Size%)+", "+
- (RAM_Load_Buffer_Length%)+", RAM_start%)")
- RAM_Load_Size%<>0
-
- _Wimp_LError(7)
-
- ;
- eval("FN_RAM_Load_Failed_"+ RAM_Load_Routine$)
- @
- _RAM_WimpScrap_Load :
- Try this way
-
- W%!12 = W%!8
- E W%!16 = 6 :
- Send RAM_Fetch
- W%!20 = RAM_start%
- ' W%!24 = RAM_Load_Buffer_Length%
- C
- "Wimp_SendMessage", 18, W%, W%!4 :
- Send recorded
- RAM_Load_Ref% = W%!8
- _Message_RAM_Fetch
- x, RAM_start%, RAM_length%
- W%!12<>save_ref%
- _Wimp_LError(9)
- RAM_Save_Routine$=""
- :
- L :
- Application won't handle RAM transfer - the external task will
- I :
- notice this when don't reply here - and initiate the normal
- # :
- <Wimp$Scrap> protocol
- :
- y
- eval("FN_RAM_Save_"+ RAM_Save_Routine$+ "("+
- (RAM_Save_Offset%)+", "+
- (W%!24)+", RAM_start%, RAM_length%)")
- B
- If no response, then other program will report error
-
- * RAM_Save_Offset% += RAM_length%
- V
- "Wimp_TransferBlock", Task_Handle%, RAM_start%, W%!4, W%!20, RAM_length%
- W%!12 = W%!8
- @ W%!16 = 7 :
- Send RAM_Transmit
- W%!24 = RAM_length%
- F
- "Wimp_SendMessage", 17 - (RAM_length%=(W%!24)), W%, W%!4
- = save_ref% = W%!8 :
- Multi-messages
-
-