checkbox in webListbox?

[quote=232983:@Alexis Colon Lugo]Hi Brock Nash
can i use webtextbox with same way for edit data on the weblistbox[/quote]
Yes you can. You can embed any containerControl. It will be up to your code to manage and destroy them however.

Hi Brock Nash

i add same code you have but with TextBox but i can no see it on the col 1

Help
------ CellClick
if cccb <> nil then
ListBox1.cellPrependControl(cccb, row, 0)
end
If mText <> nil Then
ListBox1.cellPrependControl(mText,row,1)
End If

on Show

ListBox1.AddRow
ListBox1.AddRow

cccb = new CCCheckBox
cccb.EmbedWithin(session.CurrentPage, 0, 0, cccb.Width, cccb.Height)
ListBox1.cellPrependControl(cccb, 1, 0)

mText = new tTextBox
mText.EmbedWithin(session.CurrentPage, 0, 0, mText.Width, mText.Height)
ListBox1.cellPrependControl(mText,1,0)

I’m not familiar with this. What would one have to do to ‘destroy’ such objects? What is the problem?

Once the container control is embedded, Xojo does not know how to destroy it. That will need to be done in JavaScript.

Hi Brock Nash

i am using you example project and i add textfield but i can get it to works

[quote=207817:@Brock Nash]Here’s a basic example:
https://www.dropbox.com/s/t7hpy00tpu0mdwu/EmbedCCinListbox.xojo_binary_project?dl=0[/quote]
Hi Brock,

I just read trough this thread and downloaded your sample. Pretty neat. I was wondering if you have ever embedded a checkbox in the column heading that would check and uncheck all the checkboxes in that column? If not do you have any advice on how to tackle that? I’m assuming of course that you can embed a container control in a heading?

[quote=417599:@Tom Dixon]Hi Brock,

I just read trough this thread and downloaded your sample. Pretty neat. I was wondering if you have ever embedded a checkbox in the column heading that would check and uncheck all the checkboxes in that column? If not do you have any advice on how to tackle that? I’m assuming of course that you can embed a container control in a heading?[/quote]

Look at the cellSelector method above. You should be able to create something similar for the heading, if you use chrome just inspect the DOM for the listbox and figure out the route for the header cell. Jquery/CSS Selectors are an easy thing to learn and then you could literally embed a container anywhere in your app

Thanks for the tip. Right now I’m struggling to get checkboxes in every cell in a column. The code below doesn’t work. If you have any advice on how to create multiple checkboxes and embed them in a column of listbox cells as well as being able to address their values in some indexable way I’m all ears.

[code]Public Property cccb() as CCCheckBox

Sub Shown() Handles Shown
ListBox1.AddRow
ListBox1.AddRow
ListBox1.AddRow
ListBox1.AddRow

Dim idx,n As Integer
n = ListBox1.RowCount - 1
ReDim cccb(n)

For idx = 0 To n
cccb(idx) = new CCCheckBox
cccb(idx).EmbedWithin(session.CurrentPage, 0, 0, cccb(idx).Width, cccb(idx).Height)
ListBox1.cellPrependControl(cccb(idx), idx, 0)
Next
End Sub[/code]

@Tom Dixon
You could also look at using the “” tag in your cells to embed an image of a check/emptybox and use the cell click event to toggle and track it. Check the WebListBox.Cell documentation if you want to see an example of the “” tag being used

Try this, drag in a new listbox and call this in the shown event

for r as integer = 0 to 20 Listbox1.AddRow listbox1.Cell(r,0) = "<raw><input type='checkbox' onchange='alert(this.checked)'>test</input></raw>" next

Here’s an example project using the RAW tag with eventing hooked up

https://www.dropbox.com/sh/pz4rirgt66uzjhk/AABmnx8Qc2slLmMEnMBAkemda?dl=0

Thanks Brock. I missed this earlier but I’ll go play with it now.

I just tried to modify this to make popup menus work in listbox cells as well, but failed. I’m adding rows like this:

For r As Integer = 0 To 20
Me.AddRow
Dim rows() As String
rows.Append “”
rows.Append"<option value="“volvo”">Volvo"
rows.Append"<option value="“saab”">Saab"
rows.Append"<option value="“opel”">Opel"
rows.Append"<option value="“audi”">Audi"
rows.Append""
Dim html As String= Join(rows,EndOfLine)
Me.Cell(r,0) =html
Next

The popup menu shows up and displays “Volvo”, but clicking it does not reveal the other items. If someone sees what I’m missing…

[quote=424701:@Maximilian Tyrtania]I just tried to modify this to make popup menus work in listbox cells as well, but failed. I’m adding rows like this:

For r As Integer = 0 To 20
Me.AddRow
Dim rows() As String
rows.Append “”
rows.Append"<option value="“volvo”">Volvo"
rows.Append"<option value="“saab”">Saab"
rows.Append"<option value="“opel”">Opel"
rows.Append"<option value="“audi”">Audi"
rows.Append""
Dim html As String= Join(rows,EndOfLine)
Me.Cell(r,0) =html
Next

The popup menu shows up and displays “Volvo”, but clicking it does not reveal the other items. If someone sees what I’m missing…[/quote]

Try removing the Listbox Click Events:

ExecuteJavaScript("document.getElementById('" + Listbox1.ControlID + "').removeEventListener('mousedown', Xojo.input.begin);")

See:
https://forum.xojo.com/46100-what-can-i-embed-within-a-weblistbox

Hi Brock!

I’m just getting into some of this Xojo web stuff and have a lot to learn.

Your examples are really cool and got me thinking. I am hoping to find a way to allow users to “drag” a row by a canvas I added to your container with the checkbox but am missing too much to even know if it is even possible.

Here is a quickly modified version of your project that I hoped to prove my concept with:
https://www.dropbox.com/s/lb9nkas789ne2de/EmbedCCinListbox%20ED.xojo_binary_project.zip?dl=0

I have done canvas drags in other projects where I generate dynamic controls and it works pretty well. Here the drag and drop of the independant canvas works but once embedded in your container the drag doesn’t work.

Do you have any insights to share with regards to my objective?

Thanks in advance!