REM > CreateJ.!Main
REM © James Bursa, 1997

ON ERROR ON ERROR OFF: SYS"Hourglass_Smash": ERROR 0,"Error during initialisation: "+REPORT$+" ("+STR$ERL+")": END
SYS"Hourglass_On"
Task_Name$      = "CreateJ"
Task_ThrowBack% = TRUE

LIBRARY"JLibraries:Task.2"
LIBRARY"JLibraries:Heap.2"
LIBRARY"JLibraries:Wimp.5"
LIBRARY"JLibraries:Wind.5"
LIBRARY"JLibraries:Menu.5"
LIBRARY"JLibraries:Debug.2"
LIBRARY"JLibraries:Sprite.2"
LIBRARY"JLibraries:Object.2"
LIBRARY"JLibraries:Mess.1"
LIBRARY"JLibraries:String.1"

PROCWimp_Init
LIBRARY"JLibraries:Libs.1": PROCLibs_Load(Task_Name$ + "Code:")
ON ERROR IF FNWimp_Error THEN END ELSE END
PROCTask_Init
SYS"Hourglass_Off"

ON ERROR IF FNWimp_Error THEN Task_Quit% = TRUE

 WHILE NOT Task_Quit%
  PROCWimp_Poll
 ENDWHILE

ON ERROR ON ERROR OFF: ERROR 0,"Error whilst closing down: "+REPORT$+" ("+STR$ERL+")": END
PROCTask_Close
PROCWimp_Close
END

REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
REM |  INITIALISATION & QUITTING                                            |
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜

DEF FNInit_Application
P% = B%
[OPT 2
EQUD &502: EQUD 2: EQUD 0
]
SYS"Wimp_AddMessages", B%

PROCWind_OpenC("Main")
PROCWind_PutCaret("Main", "Name")
=0

REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
REM |  EVENT PROCESSING                                                     |
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜

DEF FNClick_Main_Canc
Task_Quit% = TRUE
=0

DEF FNClick_Main_Crea
IF INSTR(FNWind_GetText("Main", "Name"), ":") = 0 THEN ERROR Erro_Warn%, "%Drag"
PROCCreate(FNWind_GetText("Main", "Name"))
=0

DEF FNClick_Main_Icon
IF Z% > 15 THEN PROCWimp_StartDrag
=0

REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜

DEF FNDragEnd
SYS"Wimp_GetPointerInfo",, B%
B%!20 = B%!12
B%!24 = B%!16
B%!28 = B%!00
B%!32 = B%!04
B%!00 = 256
B%!12 = 0
B%!16 = 1
B%!36 = 0
B%!40 = &1000
$(B% + 44) = FNWimp_GetLeaf(FNWind_GetText("Main", "Name"))
SYS"Wimp_SendMessage", 17, B%, B%!20, B%!24
=0

REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜

DEF FNMessUser_2
PROCCreate(FNWimp_GetString(B% + 44))
B%!12 = B%!08
B%!16 = 3
SYS"Wimp_SendMessage", 17, B%, B%!04
=0

DEF FNMessRec_2
=FNMessUser_2
