Editable Table

Discussion in 'Code Samples & Tips' started by RandomCoder, Jun 29, 2007.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Here's a little work in progress that might help someone?
    No special libraries are required, it just uses a Table and a TextBox.

    When a Table Cell is selected the TextBox is made to appear in place of the Cell showing the same data that was in the Cell and the soft input panel (SIP)automatically displays so that data can be entered. Unfortunately though you need to tap the TextBox to be able to start and type. I attempted to enable the TextBox cursor to allow typing straight away but failed miserably :confused:
    The data can be changed to whatever new data is required and when the Enter key is pressed the Table Cell is up-dated, the TextBox disappears and the SIP closes.

    This was designed on the Device and works perfectly (so long as the first Cell selected isn't Row 0 Column 0 - because the selection changed event doesn't fire).
    However it is a work in progress because it doesn't save the table to a file and none of the columns are set to be unique. But its easy enough to save the data to whichever format and file you want and the TextBox value could be checked before entering into the table if a column needed to be unique.

    As I said though, this was designed on the device and so on the desktop it looks a little less polished as the TextBox doesn't align neatly over the selected Cell and for some reason the desktop always shows the first Cell as selected which on the Device doesn't happen.

    Anyway, hope this gives you some inspiration to use and adapt it to your own ends :)

    Regards,
    RandomCoder
     

    Attached Files:

  2. specci48

    specci48 Well-Known Member Licensed User

    Hi RandomCoder,

    :sign0060: :sign0188: :sign0142: :sign0098:

    ... grrrr ... only 4 smilies allowed ...


    What a great effort! Nice and small code.

    I have added a version 1.1 which includes an additional timer to set the textbox focus out of the selection_changed sub.


    specci48
     
  3. specci48

    specci48 Well-Known Member Licensed User

    ... and now the file ... :sign0148:
     

    Attached Files:

  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Cheers Specci48, after reading one of the other threads I thought this might interest some people.

    Sorry that on the desktop it looks a bit rough round the edges but I just thought that its a novel way of getting around the problem.
    It blends in perfectly on the Device (I hate how the TextBoxes appear with a shadow on the desktop!) - why does the Desktop always turn out different for me :confused:

    I'm sure that it can probably be improved and the code possibly streamlined.

    Regards,
    RandomCoder.
     
Loading...