<span class="tpc_content"><font size="2">打开first_dlg.c,找到construct_cb的位置,在其中添加以下代码。 <br/><br/>int MY_construct_cb ( int dialog_id, <br/> void * client_data, <br/> UF_STYLER_item_value_type_p_t callback_data) <br/>{ <br/>int irc; <br/>UF_STYLER_item_value_type_t value; <br/>char string[133] = "Input a string here."; <br/> /* Make sure User Function is available. */ <br/> if ( UF_initialize() != 0) <br/> return ( UF_UI_CB_CONTINUE_DIALOG ); <br/><br/>value.item_id=MY_ITEM; <br/>value.item_attr=UF_STYLER_VALUE; <br/>value.value.string = string; <br/>irc = UF_STYLER_set_value(dialog_id, &value); <br/>if(irc) <br/>{ <br/> char message[132]; <br/><br/> UF_get_fail_message(irc, message); <br/>} <br/>UF_terminate ();<br/>找到input_cb的位置,假如下面的代码。 <br/><br/>int MY_input_cb ( int dialog_id, <br/> void * client_data, <br/> UF_STYLER_item_value_type_p_t callback_data) <br/>{ <br/>UF_STYLER_item_value_type_t value; <br/>int irc; <br/>char string[133]; <br/> /* Make sure User Function is available. */ <br/> if ( UF_initialize() != 0) <br/> return ( UF_UI_CB_CONTINUE_DIALOG ); <br/><br/> /* read your input */ <br/> value.item_id=MY_ITEM; <br/>value.indicator=UF_STYLER_STRING_VALUE; <br/>value.item_attr=UF_STYLER_VALUE; <br/>UF_STYLER_ask_value(dialog_id, &value); <br/><br/>strcpy(string, value.value.string); <br/>UF_STYLER_free_value(&value); <br/><br/>/** add it to the single list */ <br/>value.item_id=MY_ITEM_LIST; <br/>value.item_attr = UF_STYLER_LIST_INSERT; <br/>value.subitem_index = UF_STYLER_NO_SUB_INDEX; <br/>value.indicator = UF_STYLER_STRING_VALUE; <br/>value.value.string = string; <br/>irc = UF_STYLER_set_value(dialog_id, &value); <br/>if(irc) <br/>{ <br/> char message[132]; <br/><br/> UF_get_fail_message(irc, message); <br/>} UF_terminate ();</font></span><br/> |