Cusomizing a gotext editor

Hello,

I have set the editor style on one of my gotext objects to ComboBox.
I’d like to set additional attributes on that ComboBox. Specifically, I’d like to set:

    DropDownStyle = ComboBoxStyle.Simple
    AutoCompleteSource = AutoCompleteSource.ListItems
    AutoCompleteMode = AutoCompleteMode.SuggestAppend
    MaxDropDownItems = 10

I looked at the Editor property on the Gotext to obtain the GoControl associated with the combobox (once I set the EditorStyle), but the Editor property is set to null.

Can what I want to do be done? If so, how?

Thank you.

R. Houston

Editor only points to the ComboBox while you are in edit mode, so maybe you’re looking at the wrong time.

You could override CreateEditor, call the base and then set your own properties if it returns a ComboBox.

Thanks Jake,

I overrode CreateEditor and call MyBase.CreateEditor(view) but I don’t see any attributes on the returned GoControl that point to the ComboBox instance. I can see the combobox type information but not the instance. Thoughts?

Thanks.

R. Houston

Call FindControl on the GoControl to get the actual control.

Jake,

FindControl didn’t work. Here’s what I did:

Public Overrides Function CreateEditor(ByVal view As Northwoods.Go.GoView) As Northwoods.Go.GoControl
    Dim thisGoControl As GoControl
    thisGoControl = MyBase.CreateEditor(view)
    Dim thisControl As Control = thisGoControl.FindControl(view)

After the call to FindControl thisControl is null (nothing in VB).
I also tried this:

   Dim thisComboBox as ComboBox = ctype(thisGoControl.FindControl(view), ComboBox)

thisComboBox was null as well.

The documentation for FindControl says that it will return null if GetControl hasn’t been called. Could this be the case?

R. Houston

R. Houston

Try overriding GoText.DoBeginEdit. See the documentation for an example.