Hello,
In my GUI a have a list box (lstVariables) with variable names and an edit box (txtEditor) where I want to write a formula. When I click in the list box, I want to add the selected variable in the edit box. The difficulty is that I want to add it on the place where the cursor was.
Example : I have in the edit box the text : "var1 + var2 + var3", I select in the edit box "var2" (so it's highlighted) and than I click in the listbox on var4. The result should be : "var1 + var4 + var3". How can I find which part of the edit box is selected ?
My Example code up to now :
function lstVariables_Callback(hObject, eventdata, handles)varnames = cellstr(get(hObject,'String')) varname = varnames{get(hObject,'Value')} set(handles.txtEditor,'String',varname);
All help is appreciated.
Best regards,
Luc.
Best Answer