CNiButton

CNi

Class CNiButton Base ClassesData ItemsConstructorsDestructorsFunctionsGo to hierarchy chart    Prev page: ValidateControlNext page: BackColor    
Class Declared in:
NiButton.h

'Overview' icon -- Shortcut to top of page. Overview

CNiButton encapsulates the interface to the Measurement Studio ActiveX button control, which represents different Boolean displays such as on/off or true/false. Typically, you often use buttons to input or output Boolean information or initiate an action in your program.

CNiButton is capable of responding to events that are generated by the control. For a list of the events that can be generated by this control and details on how to respond to the events in your program, refer to the Button Events page.

Features

  • Different display styles - toggle switches, LEDs, push buttons, slides, and on/off buttons.
  • Custom bitmap buttons.
  • Button modes specify how the Button control responds to user input. For example, you can make a button respond only programmatically (you cannot make a button respond to user input). Or you can click the button to temporarily change its value and then release to revert the button to its original state (called a latch). Finally, you can click on the button to change its value until you click on it again.
  • Built-in format styles for the labels, including scientific, symbolic, engineering scaling, time, and date.
  • Animation - you can animate different parts of the control.
  • Custom background images.
  • CNiButton includes bindable properties. You can bind these properties to a DataSocket source or target. This allows you to read property values from and write property values to the source or target. Click here for a list of bindable properties.

Hierarchy Chart Hierarchy Chart

'Base Classes' icon -- Shortcut to top of page. Base Classes

'Data Items' icon -- Shortcut to top of page. Data Items

Public data CNiColor BackColor Specifies the background color of the button.
Public data CNiBindings Bindings Gets a collection of binding objects associated with the control.
Public data CString Caption Specifies the text that appears in the button.
Public data CNiColor CaptionColor Specifies the color of the caption for the button.
Public data bool Enabled Specifies if the control responds to user input.
Public data CNiFont Font Specifies the font for the caption and the two text fields in the button.
Public data bool ImmediateUpdates Specifies if the control draws new data as soon as it is available or if the form refreshes the control when it draws other controls.
Public data KeyboardModes KeyboardMode Specifies how the control handles keyboard input from the user.
Public data ButtonModes Mode Specifies how the button responds to user input.
Public data CNiColor OffColor Specifies the color of the button in the off state.
Public data CString OffText Specifies the text for the button in the off state.
Public data CNiColor OffTextColor Specifies the color of the text for the button in the off state.
Public data CNiColor OnColor Specifies the color of the button in the on state.
Public data CString OnText Specifies the text for the button in the on state.
Public data CNiColor OnTextColor Specifies the color of the text for the button in the on state.
Public data long ReadyState Returns the ready state of the control.
Public data ShowFocusModes ShowFocusMode Specifies how the control indicates it has the focus.
Public data bool Value Specifies the current value of the button.
Public data bool Windowless Specifies if the control has a window.

'Constructors' icon -- Shortcut to top of page. Constructors

Protected constructor

CNiButton( CNiInterface::ThreadAccess option = CNiInterface::MultipleThreadsWithCaching )

'Destructors' icon -- Shortcut to top of page. Destructors

Protected destructor

~CNiButton()

'Functions' icon -- Shortcut to top of page. Functions

Public function void

AboutBox()

Displays the About Box for the control.
Public function CNiPicture

ControlImage()

Returns an image of the entire control.
Protected function virtual BOOL

Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

Create( LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

CreateControl( LPCTSTR lpszClass, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Protected function BOOL

CreateControl( REFCLSID clsid, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL )

Creates the ActiveX control that is represented in the MFC program by this object.
Public function void

ExportStyle( LPCTSTR fileName )

Exports the style of the control to a file.
Protected function static const CLSID &

GetClsid()

Returns the globally unique identifier (GUID) of the ActiveX control to which this class connects.
Protected function static const IID &

GetIid()

Returns the globally unique identifier (GUID) of the ActiveX interface to which this class connects.
Public function void

ImportStyle( LPCTSTR fileName )

Imports a previously exported style.
Public function CNiImage

OffImages( long imageIndex )

Gets the image object corresponding to the Off state of the CNiButton control that is associated with the specified part of the CNiButton control.
Public function CNiImage

OffImages( const CString& imageName )

Gets the image object corresponding to the Off state of the CNiButton control that is associated with the specified part of the CNiButton control.
Public function CNiImage

OnImages( long imageIndex )

Gets the image object corresponding to the On state of the CNiButton control that is associated with the specified part of the CNiButton control.
Public function CNiImage

OnImages( const CString& imageName )

Gets the image object corresponding to the On state of the CNiButton control that is associated with the specified part of the CNiButton control.
Public function void

Refresh()

Forces the control to redraw.
Public function void

SetBuiltinStyle( ButtonStyles style )

Sets many properties of the control to represent the new style specified.
Protected function void

ValidateControl()

Validates the current state of the control.