You are on page 1of 12

1

E:\my_first_UGE:\my_first_UG\application
E:\my_first_UG\startup
E:\my_source
2
Windows UGII_USER_DIR=E:\my_first_UG
3 UG UIStyler Application
4
1"Dialog Title"First Dialog Apply Apply

2"Cue"%%%##*%****
3"Prefix Name" CHANGE MY
4StringPush ButtonLabel Single Select List

1 String
Label String -> Input an item.
Identifier "STR_0" -> "ITEM"
Width in... 0 -> 20

2) Push Button
Label "Push Button" -> "Import"
Identifier "ACTION_1" -> "IMPORT"
callbacks "action_1_act_cb" -> import_cb
"Creates Dialog"

3 Label single select list single select list


Label Label -> Items List
Identifier "LIST_2" -> "ITEM_LIST"

//??

Number 3 -> 6.

6.
save E:\my_first_UG\application first_dlg

UG

7 vc
1\application *.c *.h E:\my_source
2 Win32 DLL
3 c

8 vc
Project -> Settings -> C/C++ -> Category ....

Project -> Settings -> Link....


ug17

Tools ->Options...->Directories
Include files Libray files UG UFopen

first_dlg.c menu script

E:\my_first_UG\startup first.men()

#ifdef MENUBAR_COMMENTED_OUT
#endif

#ifdef DISPLAY_FROM_USER_EXIT
#endif
<enter a valid user exit here> ufusr

UG

first.men ACTIONS libmy_first(DLL )

Apply_cOk_cb cancel_cb OK APPLY cancel

constructor Destructor

UGUIstyler first_dlg.dlg
Apply
cancel_cb
construct_cb
destruct_cb
ok_cb
Input an Item input_cb

vc Araxis Merge
first_dlg.c construct_cb
int MY_construct_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
int irc;
UF_STYLER_item_value_type_t value;
char string[133] = "Input a string here.";
/* Make sure User Function is available. */
if ( UF_initialize() != 0)

return ( UF_UI_CB_CONTINUE_DIALOG );
value.item_id=MY_ITEM;
value.item_attr=UF_STYLER_VALUE;
value.value.string = string;
irc = UF_STYLER_set_value(dialog_id, &value);
if(irc)
{
char message[132];
UF_get_fail_message(irc, message);
}
UF_terminate ();
input_cb
int MY_input_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
UF_STYLER_item_value_type_t value;
int irc;
char string[133];
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
/* read your input */
value.item_id=MY_ITEM;
value.indicator=UF_STYLER_STRING_VALUE;
value.item_attr=UF_STYLER_VALUE;
UF_STYLER_ask_value(dialog_id, &value);
strcpy(string, value.value.string);
UF_STYLER_free_value(&value);
/** add it to the single list */
value.item_id=MY_ITEM_LIST;
value.item_attr = UF_STYLER_LIST_INSERT;
value.subitem_index = UF_STYLER_NO_SUB_INDEX;
value.indicator = UF_STYLER_STRING_VALUE;
value.value.string = string;
irc = UF_STYLER_set_value(dialog_id, &value);
if(irc)

{
char message[132];
UF_get_fail_message(irc, message);
}

UF_terminate ();

ok_cb
int irc, i;
UF_STYLER_item_value_type_t value;
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
UF_UI_open_listing_window();
value.item_id=MY_ITEM_LIST;
value.indicator=UF_STYLER_STRING_PTR_VALUE;
value.item_attr=UF_STYLER_SUBITEM_VALUES;
UF_STYLER_ask_value(dialog_id, &value);
for(i = 0; i < value.count; i++)
{
UF_UI_write_listing_window(value.value.strings);
UF_UI_write_listing_window("\n");
}
UF_STYLER_free_value( &value );
UF_terminate ();
if, endif, ufusr

single list

a minor change on code.


int MY_ok_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
int irc, i;
UF_STYLER_item_value_type_t value;
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
UF_UI_open_listing_window();
value.item_id=MY_ITEM_LIST;

value.indicator=UF_STYLER_STRING_PTR_VALUE;
value.item_attr=UF_STYLER_SUBITEM_VALUES;
irc = UF_STYLER_ask_value(dialog_id, &value);
for(i = 0; i < value.count; i++)
{
UF_UI_write_listing_window(value.value.strings);
UF_UI_write_listing_window("\n");
}
UF_STYLER_free_value( &value );

Ok list window

You might also like