A basic button. You can add a button to any user form, as well as to the Cybiko screen.
Every button must have its own modal result, which can be defined in the third parameter of the cButton_ctor function. Variants of modal results are contained in the tmResults enumeration. Every button can have a message-processing function.
You must call the cButton_ctor function before use and the cButton_dtor function after use.
Disables the cButton object so that it cannot be selected..
#include <cywin.h> ... struct cButton button; struct module_t main_module; struct cClip* parent; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_Disable( &button ) function. // Now the user can't use this object. cButton_Disable( &button ) ... // It's the same as using the cButton_Enable( &button ) function. // Now the user can use this object again. cButton_Enable( &button ) ... cButton_dtor( &button, LEAVE_MEMORY );
Disconnects the cButton object from its parent object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // Removes the object from the Cybiko screen. cButton_Disconnect( &button); ... // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); // Afterwards this function disconnects the cText object automatically cButton_dtor( &button, LEAVE_MEMORY );
Enables the cButton object so that it may be selected.
#include <cywin.h> ... struct cButton button; struct module_t main_module; struct cClip* parent; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_Disable( &button ) function. // Now the user can't use this object. cButton_Disable( &button ) ... // It's the same as using the cButton_Enable( &button ) function. // Now the user can use this object again. cButton_Enable( &button ) ... cButton_dtor( &button, LEAVE_MEMORY );
Returns the button modal result, which was set in the cButton constructor.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... if ( cButton_GetModalResult( &button ) == mrOk ) ... cButton_dtor( &button, LEAVE_MEMORY );
Returns a pointer to the parent object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; struct cClip* parent; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_GetParent( &button ) function. // Checks for the right parent relation. parent = cObject_GetParent( &button ); if ( parent == main_module.m_process ) { } ... cButton_dtor( &button, LEAVE_MEMORY );
Hides a cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_Hide( &button ) function. cObject_Hide( &button ); ... // It's the same as using the cButton_Show( &button ) function. cObject_Show( &button ); ... cButton_dtor( &button, LEAVE_MEMORY );
Selects a cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_Select( &button ) function. // Selects the button. cButton_Select( &button ); ... cButton_dtor( &button, LEAVE_MEMORY );
Shows cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... // It's the same as using the cButton_Hide( &button ) function. cObject_Hide( &button ); ... // It's the same as using the cButton_Show( &button ) function. cObject_Show( &button ); ... cButton_dtor( &button, LEAVE_MEMORY );
Initializes a cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... cButton_dtor( &button, LEAVE_MEMORY );
Deletes a cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... cButton_dtor( &button, LEAVE_MEMORY );
The Message-processing function.
#include <cywin.h> ... struct cButton button; struct module_t main_module; struct Message* ptr_message; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... ptr_message = cWinApp_get_message( main_module.m_process, 0, 1, MSG_USER ); if ( ptr_message->msgid == MSG_KEYDOWN ) { // If user presses 'Enter' button will be pushed. cButton_proc( &button, ptr_message); } ... cButton_dtor( &button, LEAVE_MEMORY );
Updates a cButton object.
#include <cywin.h> ... struct cButton button; struct module_t main_module; ... init_module( &main_module ); ... cButton_ctor( &button, "Button text", mrOk ); // Puts the 'button' object on the Cybiko screen. cWinApp_AddObj( main_module.m_process, &button, 20, 50 ); ... cWinApp_clear_screen(); // It's the same as using the cButton_update( &button ) function. // Redraws the button. cButton_update( &button ) ... cButton_dtor( &button, LEAVE_MEMORY );