UID_SetState

Declaration

Delphi

function UID_SetState(DlgHandle: Cardinal; StateId: Cardinal): Boolean; register;

C/C++

bool UID_SetState(unsigned int DialogHandle, unsigned int StateId);

ActiveX

HRESULT _stdcall UID_SetState([in] unsigned long DialogHandle, [in] unsigned long StateId, [out, retval] VARIANT_BOOL* Result);

Description

Set the state of a current dialog.

Arguments

DlgHandle

Unused.

StateId

Integer representation of a dialog state, see State types.

Return value

True on success, false otherwise.


Sample

C#
        public enum DialogStateType
        {
            idle = 0,       // dialog is not loaded on the pad (state when the pad os powered on)
            preloaded = 1, // the dialog is loaded onto the pad (automatic data from xml)
            loaded = 2,    // all data from the application has been transmitted to the pad
            running = 3,    // The running state defines that the dialog is visible and the events are polled from the pad.
            finished = 4    // The finished state defines the loaded and filled dialog being invisible and not polled.
        }

        private int setState(uint dialogHandle, DialogStateType stateType)
        {
            //  Set State of the Dialog, there are 5 Differents States (idle, preloaded, loaded, running, finished)

            uint stateHandle_loaded = 0;
            bool bResult = SigDev.UID_GetStateIdByType(dialogHandle, (uint)stateType, out stateHandle_loaded);
            if (!bResult)
            {
                throw new Exception("no loaded state specified!");
            }

            bResult = SigDev.UID_SetState((uint)dialogHandle, stateHandle_loaded);
            if (!bResult)
            {
                throw new Exception("the state " + stateType.ToString() + " couldn't be set");
            }

            return (int)stateHandle_loaded;
        }