Add Separator in WebPopupMenu

Great work! I plan on replacing the stock control with this one in all my projects. It’s so much more versatile. Thanx.

Good luck with it Scott. Let me know if you have any problems. I’ll be using in a current project also.

Johnny,

I am trying to insert an option into an already populated hdCustomSelect control but it doesn’t seem to do anything. I receive no errors and “Inserted Category” does not show anywhere in the list.

Here’s my test code.

[code] Dim newOption As new SelectOption
newOption.Caption = “Inserted Category”
newOption.Value = “-1”

cs.InsertOption(newOption, 3)
[/code]

I’ll take a look at this ASAP Scott.

Scott, It works for me.

Which browser are you testing in? Are you using grouping?

Johnny,

Yes, I’m using grouping and tested only in Safari. I have run this code in Safari and FireFox (both on Mac). Both are fine when not grouped.

When grouped…

Safari gives me the error “Could not execute returned javascript: NotFoundError: DOM Exception 8 Source: undefined

FireFox seems to work fine with one exception; hdCustomSelect1.InsertOption opt,4 is inserted as a regular selection. hdCustomSelect1.AddOption "Item in Group 2","5" does not indent under the “Insert Group” at the end of the list.

[code]Sub Open()
me.AddOption “Group 1”,“1”,False
me.AddOption “Item 1”,“1-1”
me.AddOption “Item 2”,“1-2”

End Sub
Sub Action()
Dim opt As new SelectOption

opt.Caption = “Insert Top”
opt.Value = “0”

hdCustomSelect1.InsertOption opt,0

opt = new SelectOption

opt.Caption = “Insert Item”
opt.Value = “2”

hdCustomSelect1.InsertOption opt,2

opt = new SelectOption

opt.Caption = “Insert Group”
opt.Value = “4”
opt.Selectable = False

hdCustomSelect1.InsertOption opt,4
hdCustomSelect1.AddOption “Item in Group 2”,“5”

End Sub
[/code]

Scott, I’ll take a look at this as soon as I can. It might take a day or two.

Another strange behavior. I have the control on a ControlContainer that I embed multiple time into another ControlContainer. Each time I add a new instance of that container, I cycle through the Options.Value and set the SelectedIndex to an Integer I retrieve from MySQL. It works fine on the first added container but subsequent containers just select the first item in the list and then seem to keep the UI (webpage) from refreshing; I make visible a ProgressWheel, add the containers, hide the ProgressWheel. Seems to work fine if only one container is embedded. If I embed more than one containers, the ProgressWheel is still visible even though I have set .Visible = False. My guess is that the first issues causes the second.

for i As Integer = 0 to csCategory.Options.Ubound -1 if Val(csCategory.Options(i).Value) = value then csCategory.SelectedIndex = i exit end if next

Thanx for your willingness to help.

Hopefully I’ll get few minutes to look at this today.

Scott, can you PM me an example project that shows the problem. I’m not sure I’m clear on what the problem is.

I’ve setup a webpage with 1 container control that contains three more containers which each have a select control. Then in the action event of a button on the webpage, I change the selectedindex of all three of the embedded select controls. It’s working for me.

Scott,

I’ve added a Refresh() method.

You should be able to manipulate the options() array any way you like then call Refresh().
This will remove all items from the control and reload the options() array. I’ve only tested it in Chrome.

http://www.harris-dev.com/hdCustomSelect_Demo.zip

[quote=230190:@Johnny Harris]Scott,

I’ve added a Refresh() method.

You should be able to manipulate the options() array any way you like then call Refresh().
This will remove all items from the control and reload the options() array. I’ve only tested it in Chrome.

http://www.harris-dev.com/hdCustomSelect_Demo.zip[/quote]
@Johnny Harris
There seeems to be some files missing from this demo download :slight_smile:

Albin, I’ll check this out when I get to my office.

Albin… I just uploaded a new demo project.

Great! I’ll check it out :slight_smile:
Thank you!

Works great :slight_smile:

This is stuff that really should be in the built-in control…

Is my Xojo version too out-of-date again? :wink:
Can’t remember what this error means.

Update: Darn it. Seems 2013r3.3 was too old :confused:

This has been fixed for older versions of Xojo.

Thank You Albin.