Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I want to take input and add it to the List.
Like this!
However, the triple and double pointers described in the API are hard to understand
If you know how to take text and add it to the list, please help me
thanks
PS.attach code and res file
void ListAdd(char* dialog, ProAppData data) { int names=0,i,labels; ProError status; int n_labels,n_names; char value,test[10]; char *value_arr = &value; char **get_value_arr = &value_arr; wchar_t **get_label_arr; status = ProArrayAlloc(0,sizeof(char),1,(ProArray*)&get_value_arr); status = ProArrayAlloc(0,sizeof(wchar_t),1,(ProArray*)&get_label_arr); status = ProUIListNamesGet(dialog, "List1", &names,&get_value_arr); status = ProUIListLabelsGet(dialog, "List1", &labels,&get_label_arr); get_value_arr[names+1]=(char *)calloc(30,sizeof(char)); get_value_arr[names+1]="fs\tfs"; get_label_arr[names+1]=(wchar_t *)calloc(30,sizeof(wchar_t)); ProStringToWstring(get_label_arr[names+1],"fs\tfs"); itoa(i,test,10); ProMessageDisplay(MSGFIL, (char *)"USER %0s", (char*)get_label_arr[0]); status = ProUIListNamesSet(dialog,"List1", names+1,get_value_arr); status = ProUIListLabelsSet(dialog,"List1", names+1,get_label_arr); }
(Dialog test_dialog (Components (SubLayout inputlayout) (SubLayout Content) (Separator CommitSeparator) (PushButton CommitClose) (PushButton Ok) ) (Resources (Ok.Label "Create") (Ok.TopOffset 10) (Ok.BottomOffset 10) (Ok.LeftOffset 40) (Ok.RightOffset 10) (CommitClose.Label "Cancel") (CommitClose.TopOffset 10) (CommitClose.BottomOffset 10) (CommitClose.LeftOffset 40) (CommitClose.RightOffset 10) (.Label "Parameter Control Panel") (.TopOffset 0) (.BottomOffset 0) (.LeftOffset 0) (.RightOffset 0) (.DefaultButton "CommitClose") (.Accelerator "Esc") (.AttachLeft True) (.Layout (Grid (Rows 1 0) (Cols 1) inputlayout (Grid (Rows 1 0 0)(Cols 1) Content CommitSeparator (Grid (Rows 1 1) (Cols 1 1) Ok CommitClose ) ) ) ) ) ) (Layout inputlayout (Components (InputPanel param_name_input) (InputPanel param_value_input) (Label param_name_label) (Label param_value_label) (PushButton param_set_btn) (RadioGroup radio) ) (Resources (param_name_input.Columns 15) (param_name_input.InputType 1) (param_name_input.TopOffset 5) (param_name_input.BottomOffset 5) (param_name_input.LeftOffset 5) (param_name_input.RightOffset 5) (param_value_input.Columns 15) (param_value_input.InputType 1) (param_value_input.TopOffset 5) (param_value_input.BottomOffset 5) (param_value_input.LeftOffset 5) (param_value_input.RightOffset 5) (param_set_btn.Label "Set") (param_set_btn.TopOffset 5) (param_set_btn.BottomOffset 5) (param_set_btn.LeftOffset 5) (param_set_btn.RightOffset 5) (param_set_btn.AttachRight True) (radio.Labels "Session" "Directory") (radio.Names "Session" "Directory") (radio.ButtonStyle 0) (radio.TopOffset 5) (radio.BottomOffset 5) (radio.LeftOffset 5) (radio.RightOffset 5) (radio.AttachRight True) (param_name_label.Label "Parameter Name:") (param_name_label.TopOffset 5) (param_name_label.BottomOffset 5) (param_name_label.LeftOffset 5) (param_name_label.RightOffset 5) (param_name_label.AttachLeft True) (param_value_label.Label "Parameter Value:") (param_value_label.TopOffset 5) (param_value_label.BottomOffset 5) (param_value_label.LeftOffset 5) (param_value_label.RightOffset 5) (param_value_label.AttachLeft True) (.Layout (Grid (Rows 1 0)(Cols 1 0) radio param_set_btn (Grid (Rows 1 1) (Cols 1 1) param_name_label param_name_input param_value_label param_value_input ) ) ) ) ) (Layout Content (Components (List List1) ) (Resources (List1.Names "as as""vs vs") (List1.Labels "as as""vs vs") (List1.ColumnLabel "Name Value") (List1.MinRows 5) (List1.TopOffset 0) (List1.BottomOffset 0) (List1.LeftOffset 0) (List1.RightOffset 0) (List1.ListType 1) (.AttachLeft True) (.AttachRight True) (.AttachTop True) (.TopOffset 16) (.BottomOffset 16) (.LeftOffset 10) (.RightOffset 10) (.AttachBottom True) (.Layout (Grid (Rows 1) (Cols 1) List1 ) ) ) )
The problem between double pointers and triple pointers has been resolved.
I can now add the list.
We are currently working on implementing the removal.
If anyone is facing the same problem as me, please mail me
We will provide sample code and a dialog resource file.
Hi CHASEONHO,
I like to add values to list from text file, kindly share tips or some help document..
Regards,
Manjunath S
The first, line of the file is read and stored in a string.
Then it creates a list of the strings.
///
FILE *f;
char **namearr;
wchar_t **labelarr;
int i= 0;
status = ProArrayAlloc(10, sizeof(char *), 1, (ProArray *)&namearr);
status = ProArrayAlloc(10, sizeof(wchar_t *), 1, (ProArray *)&labelarr);
f= fopen("D:\\list.txt","r");
if(f != NULL)
{
char strTemp[255];
char *pStr;
while(1)
{
pStr = fgets( strTemp, sizeof(strTemp), f );
if(pStr == NULL) break;
labelarr[i] = (wchar_t *)calloc(100, sizeof(wchar_t));
namearr[i] = (char *)calloc(100, sizeof(char));
ProStringToWstring(labelarr[i] ,pStr);
ProWstringToString(namearr[i] ,labelarr[i] )
i++;
}
fclose(f);
}
status = ProUIListNamesSet(dialog,"List2",i,namearr);
status = ProUIListLabelsSet(dialog,"List2",i,labelarr);
///
Thanks for sharing ...thank you very much..