I have a new window that show a bunch of button with extended characters. When the user click on one of those button, i want to insert the extended character on that button into a Textarea/Textfield before the extended character window pop up.
So my question is what code should i use to get the previous window and the previous control?
Treat the control name like any other variable. Add a method to the popup that accepts a parameter of type TextEdit and saves the value in a property and then shows the window. Depending on where you show the popup, either pass the control name or “me” if the code is inside the control. For example if you currently have code like
thePopup.Show
You would add a method to thePopup
Sub ShowMe(txt as TextEdit)
theTextField = txt
Show
end
Later on, you would use theTextField to put a string into the textfield/textarea. This inserts it at the cursor and replaces any highlighted text:
theTextField.SelText = theString
You now display the popup with
got it working with a global property of window gSpecCharForm and a global property of textarea gSpecCharControl and it get assigned from those field that need special character. Then when user click on one of the special characters button the following code to use to insert to the textarea field.
#pragma DisableBackgroundTasks
//******************
// insert between start or replace word.
// Last Updated : 2013-08-06
//******************
DIM i as integer, j as integer
DIM vctrl as Control
DIM vStart as integer=gSpecCharControl.SelStart
DIM vLength as integer=gSpecCharControl.SelLength
DIM vTotLength as integer=LEN(gSpecCharControl.Text)
DIM vText as String
dim vTemp as String
j=gSpecCharForm.controlcount - 1
for i = 0 to j
vctrl=gSpecCharForm.Control(i)
if vCtrl isa TextArea then
IF TextArea(vCtrl).Name=gSpecCharControl.name THEN
vText=TextArea(vCtrl).Text
IF vLength<>0 then
vTemp=LEFT(vText, vStart) + cmdChar(index).caption + MID(vText, vStart+vLength+1,vTotLength)
EXIT FOR
ELSE
vTemp=LEFT(vText, vStart) + cmdChar(index).caption + MID(vText, vStart+1,vTotLength)
EXIT FOR
END IF
END IF
END IF
Next
TextArea(vCtrl).Text=vTemp
//******************
// put characters to clipboard
// Last Updated : 2013-08-06
//******************
DIM c AS New Clipboard
c.text = cmdChar(index).caption
c.close
self.close