home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Amiga Shareware Floppies
/
ma21.dms
/
ma21.adf
/
MUIBuilder
/
examplessource
/
c
/
click.c
next >
Wrap
C/C++ Source or Header
|
1980-03-18
|
3KB
|
90 lines
#include "code.h"
#define ID_BUTTON1 1
#define ID_BUTTON2 2
#define ID_BUTTON3 3
int main()
{
ULONG signal;
BOOL running = TRUE;
APTR app, WI_try, TX_label_0, BT_1stbutton, BT_2ndbutton, BT_3rdbutton;
char STR_TX_label_0 [80];
strcpy( STR_TX_label_0, "\0338\033cClick on buttons" );
init();
app = ApplicationObject,
MUIA_Application_Author, "Eric Totel",
MUIA_Application_Base, "CLICK",
MUIA_Application_Title, "Click",
MUIA_Application_Version, "1.0",
MUIA_Application_Copyright, "(c) 1993 Eric Totel",
SubWindow, WI_try = WindowObject,
MUIA_Window_Title, "Click !!!",
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, 1,
MUIA_Group_SameWidth, 1,
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, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
/***********************/
/* Window Opening */
/***********************/
set(WI_try , MUIA_Window_Open , TRUE);
/* main loop */
while (running)
{
switch (DoMethod(app,MUIM_Application_Input,&signal))
{
case ID_BUTTON1:
sprintf( STR_TX_label_0, "\033c\0338You pressed first button");
set( TX_label_0, MUIA_Text_Contents, STR_TX_label_0 );
break;
case ID_BUTTON2:
sprintf( STR_TX_label_0, "\033c\0338You pressed second button");
set( TX_label_0, MUIA_Text_Contents, STR_TX_label_0 );
break;
case ID_BUTTON3:
sprintf( STR_TX_label_0, "\033c\0338You pressed third button");
set( TX_label_0, MUIA_Text_Contents, STR_TX_label_0 );
break;
case MUIV_Application_ReturnID_Quit:
running = FALSE;
break;
}
if (signal) Wait(signal);
}
MUI_DisposeObject(app);
}