void set_history_from_line(const string& line, bool ignore_history_commands) { if (ignore_history_commands && private_gdb_history) return; while (gdb_history.size() < 1) gdb_history += ""; gdb_history[gdb_history.size() - 1] = line; if (gdb_history_w) { int pos = gdb_history.size(); // XmListReplaceItemsPos() disturbs the current selection, so // save it here int *selected; int selected_count; if (!XmListGetSelectedPos(gdb_commands_w, &selected, &selected_count)) selected = 0; MString xm_line(line, LIST_CHARSET); XmString xms = xm_line.xmstring(); XmListReplaceItemsPos(gdb_commands_w, &xms, 1, pos); if (selected) { // Restore old selection for (int i = 0; i < selected_count; i++) XmListSelectPos(gdb_commands_w, selected[i], False); XtFree((char *)selected); } } }
static void nbcb_std_callback (Widget w, Std_Nbcb_Func v, XmPushButtonCallbackStruct * cbs) { int *posl, posc, i; XmString **items, **selected; if (XmListGetSelectedPos (netlist_list, &posl, &posc) == False) return; if (v == nbcb_find) hid_actionl ("connection", "reset", NULL); for (i=0; i<posc; i++) { LibraryMenuTypePtr net = & (PCB->NetlistLib.Menu[posl[i] - 1]); v(net, posl[i]); } n = 0; stdarg (XmNitems, &items); XtGetValues (netlist_list, args, n); selected = (XmString **) malloc (posc * sizeof (XmString *)); for (i=0; i<posc; i++) selected[i] = items[posl[i]-1]; n = 0; stdarg (XmNselectedItems, selected); XtSetValues (netlist_list, args, n); }
void WVselMotif::activate_ok( Widget w, WVselMotif *vsel, XmAnyCallbackStruct *data) { int sts; int *pos_list, pos_cnt; int i; pwr_tVolumeId *volume_ptr; volume_ptr = (pwr_tVolumeId *) calloc( vsel->volume_count, sizeof( pwr_tVolumeId)); if (XmListGetSelectedPos( vsel->widgets.volumelist, &pos_list, &pos_cnt)) { for (i = 0; i < pos_cnt; i++) { *(volume_ptr + i) = vsel->volumes[ pos_list[i] - 1]; } } if (vsel->vsel_bc_success != NULL) sts = (vsel->vsel_bc_success) ( vsel, volume_ptr, pos_cnt); free( (char *) volume_ptr); if ( ODD(sts)) { if (vsel->vsel_bc_cancel != NULL) (vsel->vsel_bc_cancel) (); delete vsel; } else if ( sts == LDH__VOLALRATT) { vsel->wow->DisplayError( "Error", " Volume is already open "); } }
static void do_hotunlink_proc(Widget, XtPointer, XtPointer) { XmString *s, cs; int *pos_list; int pos_cnt, cnt; char *cstr; int setno; set_wait_cursor(); if (XmListGetSelectedPos(hotlink_list_item, &pos_list, &pos_cnt)) { //j = pos_list[0]; XtVaGetValues(hotlink_list_item, XmNselectedItemCount, &cnt, XmNselectedItems, &s, NULL); cs = XmStringCopy(*s); if (XmStringGetLtoR(cs, charset, &cstr)) { sscanf(cstr, "S%d", &setno); if (setno >= 0 && setno < g[cg].maxplot) { set_hotlink(cg, setno, FALSE, NULL, 0); } XtFree(cstr); } XmStringFree(cs); update_hotlinks(); } unset_wait_cursor(); }
// Return number of selections and an array of selected integers int wxListBox::GetSelections(wxArrayInt& aSelections) const { aSelections.Empty(); Widget listBox = (Widget) m_mainWidget; int *posList = NULL; int posCnt = 0; bool flag = XmListGetSelectedPos (listBox, &posList, &posCnt); if (flag) { if (posCnt > 0) { aSelections.Alloc(posCnt); int i; for (i = 0; i < posCnt; i++) aSelections.Add(posList[i] - 1); XtFree ((char *) posList); return posCnt; } else return 0; } else return 0; }
/* * Remove the name from the UI and from the list if the calendar handle is NULL. * If the calendar handle is not null, tag it as deleted and it will be taken * care of later. */ static void blist_removenames(Widget widget, XtPointer client_data, XtPointer call_data) { int i, idx, valid_cnt, *pos_list, pos_cnt; Calendar *c = (Calendar *)client_data; BlistData *bd = NULL; Browselist *bl = (Browselist *)c->browselist; int rejected_name = 0; set_message(bl->message, " "); XmListGetSelectedPos(bl->browse_list, &pos_list, &pos_cnt); if (pos_cnt <= 0) { set_message(bl->message, catgets(calendar->DT_catd, 1, 17, "Select a name to remove")); return; } for (i = 0; i < pos_cnt; i++) { if (pos_list[i] == 1) { set_message(bl->message, catgets(calendar->DT_catd, 1, 16, "You may not remove the default calendar")); rejected_name++; continue; } XmListDeletePos(bl->browse_list, pos_list[i] - i + rejected_name); bd = (BlistData *)CmDataListGetData(bl->blist_data, pos_list[i]); if (bd) { bd->tag = BLIST_DELETE; } } blist_clean(bl, False); bl_list_is_changed(bl); }
void emf_terminate_external_id_cb(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *call_data) { int *sellist = NULL; int selcount; int is_selected; if (emf_idterminate_shell == NULL) { create_emf_idterminate_shell(emf_idinfo_shell); } is_selected = XmListGetSelectedPos(emf_external_list,&sellist,&selcount); if ((!is_selected) || (selcount = 0)) { post_dialog (emf_idinfo_shell,XmDIALOG_ERROR,"Select an item for termination"); return; } emf_external_id = sellist[0] - 1; free (sellist); XtManageChild(emf_idterminate_dialog); XtPopup(emf_idterminate_shell,XtGrabNone); }
void display_new_history_selection(Widget w, XtPointer *client_data, XmListCallbackStruct *call_data) { int *position_list; int num_selected; show_busy_cursor (cc_manual_hold_shell, True); /* If the history shell is up and the user selects an item from ** the manual history shell, refresh the history screen. */ if (cc_manual_hist_shell_up) { if (XmListGetSelectedPos (cc_manual_hold_list, &position_list, &num_selected)) /* Refresh if something is selected, not de-selected */ { selected_manual_hold = position_list[0]; refresh_manual_history_screen(); free (position_list); } } show_busy_cursor (cc_manual_hold_shell, False); } /* end display_new_history_selection */
void display_manual_history_screen(Widget w, XtPointer *client_data, XmListCallbackStruct *call_data) { int *position_list; int num_selected; show_busy_cursor (cc_manual_hold_shell, True); if (cc_manual_hist_shell == NULL) { create_cc_manual_hist_shell (cc_manual_hold_shell); set_editable_off(cc_hist_account_id_txt); set_editable_off(cc_hist_amount_txt); set_editable_off(cc_hist_bill_ref_no_txt); } if (XmListGetSelectedPos (cc_manual_hold_list, &position_list,&num_selected)) { selected_manual_hold = position_list[0]; if(refresh_manual_history_screen() == FAILURE) { show_busy_cursor (cc_manual_hold_shell, False); return; } XtManageChild (cc_manual_hist_form); XtPopup (cc_manual_hist_shell, XtGrabNone); cc_manual_hist_shell_up = True; } else post_dialog(cc_manual_hold_shell,XmDIALOG_ERROR, "Please select an item."); show_busy_cursor (cc_manual_hold_shell, False); } /* end display_manual_history_screen */
/*********************************************************************** * * * Copy selected items from the left list to the right list. * * * ***********************************************************************/ static void copy_cb(Widget w, XtPointer cd, XmAnyCallbackStruct *cbs) { int icnt, pos, pcnt, *posl; XmString *items; if (XmListGetSelectedPos(var2NtSList, &posl, &pcnt)) { pos = posl[pcnt-1] + 1; XtFree((char *)posl); } else pos = 0; XmListDeselectAllItems(var2NtSList); if (w == exprNtSText) { char *expr = XmTextGetString(w); if (!strempty(expr)) { XmString xms = XmStringCreateSimple(expr); XmListAddItem(var2NtSList, xms, pos); XmStringFree(xms); } XtFree(expr); /* * ugly... I don't want to show the scanner after hitting the * KActivate in the text widget */ no_scan = True; } else if (w == copyNtSButton) { XtVaGetValues(var1NtSList, XmNselectedItemCount, &icnt, XmNselectedItems, &items, NULL); XmListAddItems(var2NtSList, items, icnt, pos); } else if (w == copyAllNtSButton) { XtVaGetValues(var1NtSList, XmNitemCount, &icnt, XmNitems, &items, NULL); clear_selector_columns(2); XmListAddItems(var2NtSList, items, icnt, pos); } else if (w == var1NtSList) { XmListCallbackStruct *cbsl = (XmListCallbackStruct *) cbs; if (cbsl->event->type == ButtonRelease) XmListAddItem(var2NtSList, cbsl->item, pos); } XmListSelectPos(var2NtSList, pos, False); }
/*++++++++++++++++++++++++++++ transfer_data() ++++++++++++++++++++++++++*/ static void transfer_data(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { if ((*type == compound_text) && (y != -1)) { int i, no_selected, *select_list, pos = XmListYToPos(host_list_w, y); char *ptr; XmString str; XmStringTable xmsel; /* Retrieve the selected items from the list. */ XtVaGetValues(host_list_w, XmNselectedItemCount, &no_selected, XmNselectedItems, &xmsel, NULL); for (i = 0; i < no_selected; i++) { ptr = XmCvtXmStringToCT(xmsel[i]); str = XmStringCreateLocalized(ptr); if (pos == 0) /* Last position! */ { XmListAddItemUnselected(host_list_w, str, 0); } else { XmListAddItemUnselected(host_list_w, str, pos + i); } XmStringFree(str); } if (XmListGetSelectedPos(host_list_w, &select_list, &no_selected) == True) { XmListDeletePositions(host_list_w, select_list, no_selected); } /* Select the host that was selected last. */ str = XmStringCreateLocalized(last_selected_host); last_selected = -1; XmListSelectItem(host_list_w, str, True); XmStringFree(str); XtFree((char *)select_list); host_alias_order_change = YES; } return; }
static void MoveDownCB( Widget w, XtPointer client_data, XtPointer call_data ) { int *position_list; int position_count; if (XmListGetSelectedPos(i18n.preeditTypeList, &position_list, &position_count)) { /* there should be only one selected per our selection policy set on the list, but consider the first selected one in any case */ /* this should always be the case as the Move Down button should be insensitive when the first item is selected, but check anyway */ if (position_list[0] != i18n.preeditTypeListLastPos) { XmStringTable list_items; XmString items[2]; int sel_pos = position_list[0]; int sel_index = sel_pos - 1; XtVaGetValues(i18n.preeditTypeList, XmNitems, &list_items, NULL); /* makes an array of two XmStrings by reversing the selected one and the item succeeding it */ items[0] = list_items[sel_index + 1]; items[1] = list_items[sel_index]; /* this call preserves selected state */ XmListReplaceItemsPos(i18n.preeditTypeList, items, 2, sel_pos); if (sel_pos == (i18n.preeditTypeListLastPos - 1)) { /* it's now the last one, so set the MoveDown button insensitive */ XtSetSensitive(i18n.buttonMoveDown, False); } if (sel_pos == 1) { /* it's not anymore the first one, so set the MoveUp button sensitive */ XtSetSensitive(i18n.buttonMoveUp, True); } /* preeditType has changed */ i18n.preeditHasChanged = True; } } }
static void oneDHistListCB(Widget w, nTuBrowserInfo *nTuBrDummy, caddr_t call_data) { int i, idPos, *posList, count, id, l, jn, uid, ivar; float aa, bb; nTuBrowserInfo *nTuBr; nTuBroHs1D *nTuH1; XmListGetSelectedPos(OneDHistHistoListW, &posList, &count); if (count < 1) return; id = OneDHistListedIDs[((*posList) -1)]; uid = hs_uid(id); /* ** Select the variable associated with this histogram. */ nTuBr = oneDHistNTupleSource(id); if (nTuBr != CurrentNTupleBrowserSelected ) if (!mcfioC_SetSpecificNTupleBr(nTuBr)) return; for(i=0; i<CurrentNTupleBrowserSelected->sizeOfLists; i++) { nTuH1 = (nTuBroHs1D *) CurrentNTupleBrowserSelected->hsItemList[i]; if (nTuH1 == NULL) continue; if (nTuH1->id == id) break; } if (nTuH1 == NULL) { DialogF(DF_ERR, OneDHistShellW, 1, "Internal Error in oneDHistListCB\nPlease report", "Acknowledged"); return; } ivar = nTuH1->varNumber; XmListSelectPos(OneDHistVariableListW, (ivar+1), False); l = hs_title(id, BrowseUtil2htitle); XmTextSetString(OneDHistTitleW, BrowseUtil2htitle); l = hs_1d_hist_num_bins(id); SetIntText(OneDHistNumBinsW, l); hs_1d_hist_range(id, &aa, &bb); SetFloatText(OneDHistLowBinW, aa); SetFloatText(OneDHistHighBinW, bb); /* ** We now have to related this histogram to the associated Ntuple */ for (i=0; i<nTuBr->sizeOfLists; i++) { if (nTuBr->hsItemList[i] == NULL) continue; if (nTuBr->hsItemList[i]->id == id) { nTuH1 = (nTuBroHs1D *) nTuBr->hsItemList[i]; if (nTuH1->subBlock == -1) XmTextSetString(OneDHistMultW, "All"); else SetIntText(OneDHistMultW, nTuH1->subBlock); } break; } XtSetSensitive(OneDHistModifyW, True); XtSetSensitive(OneDHistDeleteW, True); }
void SatEnhancementCB (Widget w, XtPointer client_data, XtPointer xt_call_data ) { extern Widget sat_enhance_list; extern Widget sat_enhance_but; extern struct enhance_list satenhance_list; char color_table[20]; int *pos_list; int pos_cnt; int i; GlobalDataObjectType *gd; XmListCallbackStruct *cbs = (XmListCallbackStruct *) xt_call_data; /* * Get color table to use. */ if ( ! ( XmListGetSelectedPos ( sat_enhance_list, &pos_list, &pos_cnt ) && ( pos_cnt == 1 ) ) ) return; i = pos_list[0] - 1; free ( pos_list ); strcpy ( color_table, satenhance_list.list[i] ); /* * Add extension for color tables. */ if ( ! ( strcmp ( color_table, "DEFAULT" ) == 0 || strcmp ( color_table, "gray" ) == 0 ) ) strcat ( color_table, ".tbl" ); /* * Save parameters. */ gd = GetGlobalDataObject(); SetDefColortable ( gd, color_table ); SetBackgroundColors ( gd, satenhance_list.background[i] ); SetForegroundColors ( gd, satenhance_list.foreground[i] ); /* * Change lutfile. */ newlut ( color_table ); if( DefaultDepthOfScreen(DefaultScreenOfDisplay(XtDisplay(w))) != 8 ) { RefreshDisplay ( ); /* Necessary for > 8-bit displays to redraw images with new pixel values reflecting new read-only color table entries */ } }
static char* motListGetValueAttrib(Ihandle* ih) { if (ih->data->has_editbox) { char *str, *xstr; Widget cbedit; XtVaGetValues(ih->handle, XmNtextField, &cbedit, NULL); xstr = XmTextFieldGetString(cbedit); str = iupStrGetMemoryCopy(xstr); XtFree(xstr); return str; } else { if (ih->data->is_dropdown) { char* str; int pos; XtVaGetValues(ih->handle, XmNselectedPosition, &pos, NULL); str = iupStrGetMemory(50); sprintf(str, "%d", pos+1); /* IUP starts at 1 */ return str; } else { int *pos, sel_count; if (XmListGetSelectedPos(ih->handle, &pos, &sel_count)) /* XmListGetSelectedPos starts at 1 */ { if (!ih->data->is_multiple) { char* str = iupStrGetMemory(50); sprintf(str, "%d", pos[0]); XtFree((char*)pos); return str; } else { int i, count; char* str; XtVaGetValues(ih->handle, XmNitemCount, &count, NULL); str = iupStrGetMemory(count+1); memset(str, '-', count); str[count]=0; for (i=0; i<sel_count; i++) str[pos[i]-1] = '+'; XtFree((char*)pos); return str; } } } } return NULL; }
void RGISGrpPanel::Remove (DBObjTableField *group) { int *selectPos, selectCount; if(!XmListGetSelectedPos (GroupListWGT,&selectPos,&selectCount)) return; if (selectCount > 1) { XtFree ((char *) selectPos); return; } XmListDeleteItemsPos (GroupListWGT,1,selectPos [0]); if (GroupLIST != (DBObjectLIST<DBObjTableField> *) NULL) XmListSelectPos (GroupListWGT,selectPos [0],True); }
static void modifyOneDHistCB(Widget w, nTuBrowserInfo * nTuBr, caddr_t call_data) { int *posList, count; if (!XmListGetSelectedPos(OneDHistHistoListW, &posList, &count)) { DialogF(DF_WARN, OneDHistShellW, 1, "Please select a Histogram", "Acknowledged"); return; } deleteOneDHistCB(w, NULL, NULL); createOneDHistActual(False); }
static void bl_list_selection_cb(Widget w, XtPointer data, XtPointer cbs) { Calendar *c = (Calendar *) data; Browselist *bl = (Browselist *)c->browselist; int *pos_list, pos_cnt; XmListGetSelectedPos(bl->browse_list, &pos_list, &pos_cnt); if (pos_cnt <= 0) XtSetSensitive(bl->remove_button, False); else XtSetSensitive(bl->remove_button, True); }
static void _UISymbolLoadNamesCBK (Widget widget,Widget list,XmAnyCallbackStruct *callData) { int symbol, symNum, i, color, *selectPos, selectCount; FILE *file; char *fileName, buffer [1024], *token, delimit [3]; static Widget select = NULL; UISymbol**editSymbols; XmString xmString [1]; widget = widget; callData = callData; if (select == NULL) select = UIFileSelectionCreate ((char *) "Symbol Name file Selection",NULL,(char *) "*.txt",XmFILE_REGULAR); XtVaGetValues (list,XmNuserData, &editSymbols, NULL); XtVaGetValues (list,XmNitemCount, &symNum, NULL); if ((fileName = UIFileSelection (select,true)) == NULL) return; if ((file = fopen (fileName,"r")) == NULL) { CMmsgPrint (CMmsgSysError, "File Openning Error in: %s %d",__FILE__,__LINE__); return; } sprintf (delimit,"%c%c",DBASCIISeparator,'\0'); while (fgets (buffer,sizeof (buffer),file) != NULL) { token = strtok (buffer,delimit); sscanf (token,"%d",&symbol); for (i = 0;i < symNum; ++i) if (editSymbols [i]->SymbolID () == symbol) { if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) { if (token [0] == '\"' || token [0] == '\'') {token [strlen (token) - 1] = '\0'; token++; } editSymbols [i]->Name (token); } if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) if (sscanf (token,"%d",&color) == 1) editSymbols [i]->Foreground (color); if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) if (sscanf (token,"%d",&color) == 1) editSymbols [i]->Background (color); xmString [0] = XmStringCreate (editSymbols [i]->Name (),UICharSetNormal); XmListReplaceItemsPos (list,xmString,1,i + 1); XmStringFree (xmString [0]); break; } } if (XmListGetSelectedPos (list,&selectPos,&selectCount)) { XmTextFieldSetString (XtNameToWidget (XtParent (XtParent (XtParent (list))),UISymTextFieldName),editSymbols [selectPos [0]]->Name ()); XtFree ((char *) selectPos); } }
// Get single selection, for single choice list items int wxDoGetSelectionInList(Widget listBox) { int *posList = NULL; int posCnt = 0; bool flag = XmListGetSelectedPos (listBox, &posList, &posCnt); if (flag) { int id = -1; if (posCnt > 0) id = posList[0] - 1; XtFree ((char *) posList); return id; } else return -1; }
void emf_modify_external_id_cb(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *call_data) { EXTERNAL_ID_DATA_TYPE modify_order; int *sellist = NULL; int selcount; int is_selected; memset (&modify_order,0,sizeof(EXTERNAL_ID_DATA_TYPE)); if (emf_iddetail_shell == NULL) { create_emf_iddetail_shell(emf_idinfo_shell); XtAddEventHandler(emf_iddetail_start_txt,KeyPressMask,False, check_date,NULL); XtAddEventHandler(emf_iddetail_end_txt,KeyPressMask,False, check_date,NULL); } is_selected = XmListGetSelectedPos(emf_external_list,&sellist,&selcount); if ((!is_selected) || (selcount = 0)) { post_dialog (emf_idinfo_shell,XmDIALOG_ERROR,"Select an item for modification"); return; } emf_external_id = sellist[0] - 1; free (sellist); display_emf_external_id_data_on_screen (active_external_ids[emf_external_id]); /* initialize struct for confirming cancel */ memset (&emf_old_external_id,0,sizeof(emf_old_external_id)); get_emf_external_id_data_from_screen (&emf_old_external_id); set_editable_off(emf_iddetail_id_txt); emfx_modify_flag = TRUE; emfx_shell_up = TRUE; XtManageChild (emf_iddetail_form); XtPopup (emf_iddetail_shell,XtGrabNone); }
// OK pressed in `Lookup Source' static void lookupSourceDone(Widget w, XtPointer client_data, XtPointer call_data) { Widget sources = Widget(client_data); XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data; set_status(""); string source = get_item(w, client_data, call_data); if (source.contains('/')) { // Expand to full path name int *position_list = 0; int position_count = 0; if (XmListGetSelectedPos(sources, &position_list, &position_count)) { if (position_count == 1) { int pos = position_list[0]; pos--; if (pos < 0) pos = all_sources.size() - 1; source = all_sources[pos]; } XtFree((char *)position_list); } } if (!source.empty()) { source_view->lookup(source + ":1"); if (cbs != 0 && cbs->reason != XmCR_APPLY && cbs->reason != XmCR_ACTIVATE) { Widget scroll = XtParent(sources); Widget dialog = XtParent(scroll); XtUnmanageChild(dialog); } } }
void CLogMotif::filesel_ok_cb( Widget w, CLog *clog, XmAnyCallbackStruct *data) { int *pos_list, pos_cnt; int key; if (XmListGetSelectedPos( ((CLogMotif *)clog)->filesel_list_w, &pos_list, &pos_cnt)) { clog->set_clock_cursor(); clog->clognav->read( pos_list, pos_cnt); clog->reset_cursor(); } XtVaGetValues (w, XmNuserData, &key, NULL); switch (key) { case 1: XtUnmanageChild( ((CLogMotif *)clog)->filesel_form); } }
void setselectedcode(ListData *ld) { int *position_list; int position_count; int i; int *codep; XmListGetSelectedPos(ld->list, &position_list, &position_count); ld->ed->code_num = position_count; ld->ed->gpf_code_list = (int *) calloc(position_count, sizeof(int)); codep = ld->ed->gpf_code_list; for (i = 0; i < position_count; i++) { *codep = *((ld->existcode)+(position_list[i]-1)); codep++; } }
static int motFileDlgGetMultipleFiles(Ihandle* ih, const char* dir, Widget wList) { int *pos, sel_count, dir_len; int i, len, cur_len; char *filename, *all_names; Iarray* names_array; XmString* items; if (!XmListGetSelectedPos(wList, &pos, &sel_count)) return 0; names_array = iupArrayCreate(1024, 1); /* just set an initial size, but count is 0 */ XtVaGetValues(wList, XmNitems, &items, NULL); cur_len = strlen(dir); all_names = iupArrayAdd(names_array, cur_len+1); memcpy(all_names, dir, cur_len); all_names[cur_len] = '|'; dir_len = cur_len; cur_len++; /* skip separator */ for (i = 0; i<sel_count; i++) { filename = iupmotConvertString(items[pos[i]-1]); /* XmListGetSelectedPos starts at 1 */ len = strlen(filename)-dir_len; cur_len = iupArrayCount(names_array); all_names = iupArrayAdd(names_array, len+1); memcpy(all_names+cur_len, filename+dir_len, len); all_names[cur_len+len] = '|'; } XtFree((char*)pos); cur_len = iupArrayCount(names_array); all_names = iupArrayInc(names_array); all_names[cur_len+1] = 0; iupAttribStoreStr(ih, "VALUE", all_names); iupArrayDestroy(names_array); return 1; }
void ppp_prov_list_select_cb(Widget w, XtPointer *client_data, XmListCallbackStruct *call_data) { char *text, TempString[10]; int StringLength, n, Selected, is_selected, total_start; XmString *strlist; int *sellist = NULL; int selcount; /* Set the value of the Associations Text box */ is_selected = XmListGetSelectedPos(ppp_prov_list,&sellist,&selcount); if (is_selected) { XtVaGetValues (ppp_prov_list, XmNitems, &strlist, NULL); Selected = sellist[0] - 1; XmStringGetLtoR (strlist[Selected], XmFONTLIST_DEFAULT_TAG, &text); StringLength = strlen(text); total_start = 0; for (n=StringLength-1; n > 0; n--) { if (text[n] == ' ') { total_start = n + 1; break; } } if (total_start > 0) { for (n=0; total_start + n < StringLength; n++) { TempString[n] = text[total_start+n]; } } TempString[n] = '\0'; XmTextSetString (ppp_num_associations_txt, TempString); } }
void CoWowMotif::list_ok_cb( Widget w, XtPointer data, XmAnyCallbackStruct *cbs) { wow_tListCtx ctx = (wow_tListCtx) data; int *pos_list, pos_cnt; static char selected_text[512]; if ( ctx->action_cb) { if (XmListGetSelectedPos( ctx->list, &pos_list, &pos_cnt)) { strcpy( selected_text, ctx->texts + (pos_list[0] - 1) * ctx->textsize); (ctx->action_cb)( ctx->parent_ctx, selected_text); XtFree( (char *)pos_list); } } XtDestroyWidget( ctx->toplevel); free( ctx->texts); free( ctx); }
void AliasListUiItem::handleDeleteButtonPress() { Widget list_widget = this->getWidget(); int *p_list, p_count; // get the selected position if(XmListGetSelectedPos(list_widget, &p_list, &p_count)) { if(deleted_items == NULL) { deleted_items = new DtVirtArray<char *>(10); } deleted_items->append(strdup((*list_items)[p_list[0] -1]->label)); // delete the item from our list this->list_items->remove(p_list[0] - 1); // remove only first // delete the item from the widget XmListDeletePos(list_widget, p_list[0]); XtVaSetValues(this->getKeyWidget(), XmNvalue,"", NULL); XtVaSetValues(this->getValueWidget(), XmNvalue,"", NULL); XmListSelectPos(list_widget, p_list[0], TRUE); props_changed = TRUE; } }
void setup_detail_screen(Widget w, XtPointer *client_data, XmPushButtonCallbackStruct *call_data) { int *position_list; int num_selected; show_busy_cursor (cc_manual_hold_shell, True); if (XmListGetSelectedPos (cc_manual_hold_list, &position_list,&num_selected)) { selected_manual_hold = position_list[0]; free (position_list); cc_change_type = (int)client_data; display_manual_detail_screen (); } else post_dialog(cc_manual_hold_shell,XmDIALOG_ERROR, "Please select an item to change."); show_busy_cursor (cc_manual_hold_shell, False); } /* end setup_detail_screen */
void cc_credit_process_btn_cb(Widget w, XtPointer *client_data, XmPushButtonCallbackStruct *call_data) { int *position_list; int num_selected; show_busy_cursor (cc_credit_hold_shell, True); if (XmListGetSelectedPos (cc_credit_list, &position_list, &num_selected)) { process_credit_holds(position_list, num_selected); refresh_credit_hold_screen(); free (position_list); } else post_dialog(cc_credit_hold_shell, XmDIALOG_ERROR, "Please select one or more items to process."); show_busy_cursor (cc_credit_hold_shell, False); } /* end cc_credit_process_btn_cb */