Notifications
Clear all
[Closed] listbox editable text fields
Feb 13, 2012 4:56 pm
Is there a dotnet item that allows users to double click and edit the displayed text in that cell?
I know there are work arounds such as creating a popup dialog with an edit text field and all that, it’s just annoying to do and I was hoping dotnet had something more simple.
(
try (destroyDialog ::rlListBox) catch()
rollout rlListBox "Drop Down List"
(
dotNetControl lbItems "System.Windows.Forms.ListBox" height:100 ItemHeight:10
on lbItems SelectionChangeCommitted e do
(
print "here it goes"
fnUpdateList()
)
on lbItems doubleClicked itm do
(
lbItems.text = lbItems.items["cool"]
)
on rlListBox open do
(
lbItems.items.addrange #("nice","nice","nice","nice")
)
)
createDialog rlListBox
)
4 Replies
1 Reply
it’s pain in the a$$ really. that’s why for this kind of interface solution i moved from listview to datagrid.
Feb 13, 2012 4:56 pm
I used this: http://forums.cgsociety.org/showthread.php?p=4832734#post4832734
And modified it to get the bounds of the cell being clicked -- and replaced it with a .net textbox. The textbox currently excepts esc or enter and then does some work to update the object model.
fn subItemAtMousePos lv =
(
-- this has the potential to miss selecting an item that could cause an error... might as well ignore it and
-- let the user just double click again.
try
(
-- get mouseposition on screen
local pos = lv.mousePosition -- screen position
local posScreen = [pos.x, pos.y] -- need the screen position for placement of new edittext
-- get dialog (specifically the LV) position information
pos = lv.PointToClient pos
local posDialog = [pos.x, pos.y]
-- get information for the listview item & subitem
local li = lv.getItemAt pos.x pos.y
local si = li.getSubItemAt pos.x pos.y
-- Get the bounding box position.
local posBounds = [si.Bounds.X, si.Bounds.Y-2]
-- do the math.
posFinal = ((posScreen - posDialog) + posBounds)
-- Get the indices for listview item index and the subitem index.
local idxs = #( li.index , (li.subitems.indexof si) )
--// debug print
print lv.Items.item[idxs[1]].subitems.item[idxs[2]].text
::g_tempEditTextBoxInfo = lv.Items.item[idxs[1]].subitems.item[idxs[2]].text -- I needed to add a global that the second rollout can read on create
createDialog NetTextBoxTest style:#(#style_sunkenedge) pos:posFinal modal:true -- make the dialog look integrated.
)
)
catch()
)
Feb 13, 2012 4:56 pm
Do you have any examples of that which I could check out and see for reference.
1 Reply