Table Of Contents

Graph IDEProgramming ► Adapter

The following is a complete script for programming an Adapter graphic.

/*
Adapter script for a segmented control.
*/

@@class() Widestring:Object

@@method(public, class) (id)alloc;
@@method(public, instance) (id)init;
@@method(public, instance) (id)value;
@@method(public, instance) (void)copyUTF8String:(const char *)aUTF8String;
@@method(public, instance) (void)release;

@@end

@@class() GraphicAdapter:Object

@@method(public, class) (id)stored;
@@method(public, instance) (unsigned)executionCount;
@@method(public, instance) (id)value;

@@end

@@class() SAI_Segmented_Control:Object

@@method(public, instance) (void)set_SAI_number_of_segments:(unsigned)a_value;
@@method(public, instance) (unsigned)get_SAI_number_of_segments
@@method(public, instance) (void)set_SAI_segment_style_type:(unsigned)a_value;
@@method(public, instance) (unsigned)get_SAI_segment_style_type

@@method(public, instance) (void)SAI_update_segment_index:(unsigned)an_index to_widestring:(id)a_widestring

@@end

/* Execution block */

{
id myAdapter;
unsigned executionCount;

myAdapter = [GraphicAdapter stored];
executionCount = [myAdapter executionCount];

if(executionCount == 1U)
{
id myAdapterValue;
id myString;

myAdapterValue = [myAdapter value];
myString = [[Widestring alloc] init];

[myAdapterValue set_SAI_number_of_segments:3U];

[myString copyUTF8String:"One"];
[myAdapterValue SAI_update_segment_index:0U to_widestring:[myString value]];
[myString copyUTF8String:"Two"];
[myAdapterValue SAI_update_segment_index:1U to_widestring:[myString value]];
[myString copyUTF8String:"Three"];
[myAdapterValue SAI_update_segment_index:2U to_widestring:[myString value]];

[myAdapter registerWithName:"a_name"];
}

}

The general API is define in the section Graphic.

API specific to the adapter is defined below.

@@method(public, instance) (id)value;
  Call like this:

myValue = [myAdapter value];

Returns the native view object. Once you have a handle to that view object you may call upon it as needed. Probably the best thing to do is to make remedial changes to it in the script and then register the adapter with the controller to set it up further.




© Copyright 1993-2022 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.