home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Amiga Shareware Floppies
/
ma21.dms
/
ma21.adf
/
MUIBuilder
/
examplessource
/
e
/
Click.e
next >
Wrap
Text File
|
1994-01-09
|
3KB
|
115 lines
OPT OSVERSION=37
MODULE 'muimaster', 'libraries/mui'
MODULE 'utility/tagitem', 'utility/hooks'
MODULE 'intuition/classes', 'intuition/classusr'
CONST MUI_TRUE = 1
ENUM ID_BUTTON1 = 1, ID_BUTTON2, ID_BUTTON3
PROC main()
DEF signal, result_DoMethod, running = TRUE
DEF app, wi_try, tx_label_0, bt_1stbutton, bt_2ndbutton, bt_3rdbutton
DEF stR_TX_label_0 : PTR TO CHAR
stR_TX_label_0 := '\e8\ecClick on buttons'
IF (muimasterbase := OpenLibrary('muimaster.library',0)) = NIL
CleanUp(100)
ENDIF
app := ApplicationObject,
MUIA_Application_Author, 'Eric Totel',
MUIA_Application_Base, 'CLICK',
MUIA_Application_Title, 'Click',
MUIA_Application_Version, '1.0',
MUIA_Application_Copyright, 'Eric Totel 1994',
MUIA_Application_Description, 'just a demo !!!',
SubWindow, wi_try := WindowObject,
MUIA_Window_Title, 'Click !!!',
MUIA_HelpNode, 'WI_try',
WindowContents, GroupObject,
Child, tx_label_0 := TextObject,
MUIA_Background, 131,
MUIA_Text_Contents, stR_TX_label_0,
MUIA_Text_SetMax, 0,
MUIA_Text_SetMin, 1,
MUIA_Frame, 9,
End,
Child, GroupObject,
MUIA_Group_Horiz, MUI_TRUE,
MUIA_Group_SameWidth, MUI_TRUE,
Child, bt_1stbutton := KeyButton( 'Button 1', "1" ),
Child, bt_2ndbutton := KeyButton( 'Button 2', "2" ),
Child, bt_3rdbutton := KeyButton( 'Button 3', "3" ),
End,
End,
End,
End
/************************/
/* Buttons Notification */
/************************/
doMethod( bt_1stbutton, [ MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, ID_BUTTON1 ] )
doMethod( bt_2ndbutton, [ MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, ID_BUTTON2 ] )
doMethod( bt_3rdbutton, [ MUIM_Notify, MUIA_Pressed, FALSE, app, 2, MUIM_Application_ReturnID, ID_BUTTON3 ] )
/***********************/
/* Window closing */
/***********************/
doMethod( wi_try, [ MUIM_Notify, MUIA_Window_CloseRequest, MUI_TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit ] )
/***********************/
/* Window Opening */
/***********************/
set( wi_try, MUIA_Window_Open , MUI_TRUE )
/* main loop */
WHILE running
result_DoMethod := doMethod( app, [ MUIM_Application_Input, {signal} ] )
SELECT result_DoMethod
CASE ID_BUTTON1
set( tx_label_0, MUIA_Text_Contents, '\ec\e8You pressed first button' )
CASE ID_BUTTON2
set( tx_label_0, MUIA_Text_Contents, '\ec\e8You pressed second button' )
CASE ID_BUTTON3
set( tx_label_0, MUIA_Text_Contents, '\ec\e8You pressed third button' )
CASE MUIV_Application_ReturnID_Quit
running := FALSE
ENDSELECT
IF signal THEN Wait( signal )
ENDWHILE
MuI_DisposeObject( app )
ENDPROC
PROC doMethod( obj:PTR TO object, msg:PTR TO msg )
DEF h:PTR TO hook, o:PTR TO object, dispatcher
IF obj
o := obj-SIZEOF object /* instance data is to negative offset */
h := o.class
dispatcher := h.entry /* get dispatcher from hook in iclass */
MOVEA.L h,A0
MOVEA.L msg,A1
MOVEA.L obj,A2 /* probably should use CallHookPkt, but the */
MOVEA.L dispatcher,A3 /* original code (DoMethodA()) doesn't. */
JSR (A3) /* call classDispatcher() */
MOVE.L D0,o
RETURN o
ENDIF
ENDPROC NIL