Editable combobox for Widget.Preferences- Help?

I need a little help figuring out how to use this property. Specifically when you change the text of the preset entries, how do you make the change permanent?

Widget.AddPreference "box1"
Widget.Preference("box1").Type = "ComboEdit"
Widget.Preference("box1").Caption = "BoxName"
Widget.Preference("box1").AddValue "item1"
Widget.Preference("box1").AddValue "item2"
Widget.Preference("box1").AddValue "item3"


I can edit the names of any one of those entries in widget mode but the changes don’t take effect. I don’t see any further elaboration on this in the DG. Can anyone who has had any experience with this help me out here? Thanks.
2,561 views 3 replies
Reply #1 Top
Furthermore, when using a regular combobox I can use Sub Control_OnSelect to trigger an action as soon as I select something from the drop down. I can't do that with a widget.preference combobox. Can I?
Reply #2 Top
There are many ways to use this. Please look below...

Sub MyBox
On Error Resume Next
Set objBOX = nothing
Set objBOX = DesktopX.CreateForm
With objBOX
.caption = " DesktopX Form Name... "
.addpreference("box1")
.preference("box1").Type = "comboedit"
.preference("box1").caption = "BoxName"
.preference("box1").addvalue "item1"
.preference("box1").addvalue "item2"
.preference("box1").addvalue "item3"
.preference("box1").defaultvalue = "item1"
If .prompt Then
desktopx.object("My Object").text = .preference("box1").value
End If
End With
Set objBOX = nothing
End Sub

This code will work as a regular combobox.
Best Regards.
Reply #3 Top
EDIT: Thanks, Vad_M. While I found this script to be extremely useful I still can't get the action to fire as soon as I select something from the drop down. I'd have to click 'ok' before the changes take effect. Here's my goal really:



I'd select something from the "Select Group" drop down at the top and the information in the fields below would change according to what group I selected.
Group 1 would display:
Group Name: "News"
Browser 1: cnn.com
Browser 2: cspan.com
etc.

Group 2 would display:
Group Name: "OS Customization"
Browser1: wincustomize.com
Browser2: stardock.com
etc.


Essentially I'm making changes within the form or properties box before I click ok and apply them to the widget. If I could simply edit the items in the "Select Group" box I wouldn't need the 2nd box, Group Name. I hope I've explained this well.