New topic: Listbox-Popup and Tabs
<http://forums.realsoftware.com/viewtopic.php?t=39811> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message JohnWheeler Post subject: Listbox-Popup and TabsPosted: Tue Jul 12, 2011 2:08 pm Joined: Mon Apr 19, 2010 12:58 pm Posts: 88 Hi, I downloaded the listbox with popups from the Arbp website, first thing I noticed that it only works with mouse clicks. So I added a tab method in the cellkeydown event. Code: //Tabs through the listbox, counts the columns and down to next row If key = chr(9) or key = chr(29) Then If column=me.ColumnCount-1 Then If row=me.ListCount-1 Then me.EditCell(0,0) Else me.EditCell(row+1,0) End If Else me.EditCell(row,column+1) End If End If If key = chr(31) and celltype(row, column) = TypePopup Then showMenu row, column End If return CellKeyDown(row, column, key) The idea being to either use the tab or the right arrow key to move between cells, but when you tab into a cell with a popup the cellclick will not operate, so I set the down arrow key to open the popup, which it does but the selected text does not enter into the cell. I have followed it through the debugger and hitItem from the ShowMenu method has the correct choice. I also noticed without the Tabs method, if you select the popup with the mouse you are able to move to the selection with the down arrow key and use the return to select. Below is the ShowMenu Method Code: dim x as integer = me.getcellx(col) + me.left + me.Window.left dim y as integer = me.getcelly(row) + me.top + me.Window.top //Create the base menu dim base as new MenuItem //Add our array data. Note, you could change the array data for each row if you wanted. dim s() as string = me.celltag(row,col) for i as integer = 0 to s.Ubound base.Append New MenuItem(s(i)) next //Do the popup dim hitItem as menuitem = base.PopUp(x, y) me.Cell(row, col) = choice //Raise the event so the user can handle it however they want. RaiseEvent MenuAction row, col, hititem and the MenuAction event Code: if hitItem = nil then msgbox "You selected nothing." else //msgbox "You selected row " +str(row)+ " column "+str(column) me.Cell(row, column) = hitItem.text me.InvalidateCell(row, column) end Any idea's please Regards John Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
