Search Unity

Table Pro: When Your Data isn't a Game

Discussion in 'Assets and Asset Store' started by slumtrimpet, Aug 15, 2015.

  1. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    The table object has several methods like:
    • MoveSelectionUp
    • MoveSelectionDown
    • MoveSelectionLeft
    • MoveSelectionRight
    Others have used those methods to implement keyboard and controller-based navigation when desired. We don't directly handle those implementation specific details, but we expose those methods to let you do so.
     
  2. slrbatman

    slrbatman

    Joined:
    Aug 21, 2015
    Posts:
    2
    I am using this plugin to display some session data in a blended UWP / Unity Xbox application. We are using an Xbox One Controller and Kinect as input devices with no keyboard. Was wondering if anyone has wired up a Game Controller for input with the plugin with no keyboard or mouse? I would like to highlight the first row in the table on load and be able to scroll through the table only using the controller. Any ideas / help would be much appreciated.
     
  3. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Actually... yeah. Without seeming like a punk, very similar answer here to the last post I made. Others have implemented keyboard and gamepad nav by using some methods we've got on our table:
    • MoveSelectionUp
    • MoveSelectionDown
    • MoveSelectionLeft
    • MoveSelectionRight
    There's also a SetSelection method you can use to set the initial selected row to whatever you wish.
     
  4. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    OK, but I need a bit more guidance and/or an example. I have a table with 3 Input columns. Here's what happens when I'm running the following code (which of course is just a starting point):

    public void Update() {
    if (Input.GetKeyDown(KeyCode.Tab))
    this.table.MoveSelectionRight(false);
    }

    When I have entered text in column 1, then hit tab, the selection highlight moves to column 2 of the same row, as desired, but the text insertion point remains where it was, at the end of the new text in column 1. How do I tell it to go elsewhere, to column 2 in this case? And also fire OnInputFieldChange for column 1's cell. Thanks
     
  5. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Ah... good question there. I'm not sure you might be the first person to attempt keyboard nav with input fields like that. I just put a patch into the TablePro trunk but I can summarize here so you can test:

    In Cell.cs between rows 260 and 261 insert:

    Code (csharp):
    1.  
    2.     if(this.row.datum != null && this.row.datum == this.table.selectedDatum &&
    3.        this.column != null && this.column == this.table.selectedColumn) {
    4.       this.table.inputCell.SetFocus(this);
    5.     }
    6.  
    In InputCell.cs between rows 71 and 72 insert:

    Code (csharp):
    1.  
    2.     this.inputField.MoveTextStart(false);
    3.     this.inputField.MoveTextEnd(true);
    4.  
    That seems to work for me. Please let me know if that behaves for you and I'll roll a "real" patch and push it out.
     
  6. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Thanks, works well. That's getting me 90% of the way there. I'm using the behavior of tables in MS Word 2013 as my gold standard. The remaining problem I see is with the left and right arrow keys. The basic behavior is correct... when I MoveSelectionRight with the tab key, to a cell that already has content, that content is highlighted. If I then begin typing, the old content is discarded. On the other hand, if I hit left-arrow, the old text is retained and the text cursor moved to its start. Likewise, if I hit right-arrow, the old text is retained and the text cursor moved to its end. All good.

    But in Word, if the text cursor is at the start of the cell's text and I hit the left-arrow, it moves the previous cell. Similarly, if at the end of the cell's text and I hit the right-arrow, it moves to the next cell. Now, I can catch the left- and right-arrow presses myself, and move among cells, but how do I keep that from interfering with the desirable behavior in the above paragraph? Equivalently, how can my code detect where the text cursor is (i.e., start of text, end of text, within text)? And if within-text, pass the arrow keys down into the input cell for processing.
     
  7. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    You're getting a bit far off into the weeds to "implementation specific" stuff for me to be able to speak in huge detail to this, but the magic will be cenetered around:

    Code (csharp):
    1. table.inputCell.inputField
    That's a regular https://docs.unity3d.com/Manual/script-InputField.html object reference. All the attributes and limitations of that object apply. I've never tried to implement your specific request there but anything you can do with a regular input field should be doable here.
     
  8. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Thanks for the pointer, I'll check that out.

    Further testing shows 3 other problems:
    1) Given my table described earlier with empty cells, when the player clicks on any arbitrary input cell, the selection always changes correctly, but roughly 10% of the time, the text cursor doesn't appear, so subsequent typing goes into the bin bucket. The player has to click again to get the cursor.

    2) My table actually begins with a non-input column that has the row number. That is, the design is:
    [code/// table width is 400.
    table.AddTextColumn(null,null,25,25);
    table.AddInputColumn(OnInputFieldChange,"Input 1",null,50,50);
    table.AddInputColumn(OnInputFieldChange,"Input 2",null,210,210);
    table.AddInputColumn(OnInputFieldChange,"Input 3",null,70,70);[/code]
    If the player clicks on the first column, it should be read-only, but it's not. The player can edit it, with dire consequences.

    3) A workaround for (2) is to catch the selection and force it to the second column with table.MoveSelectionRight. However, that sometimes exhibits a variation of problem (1). Sometimes the text cursor in the second column doesn't appear. In which case, if the player continues to select cells in column 1 (yeah, I know, artificial, but may give insight into causation), the evoked selection in column 2 will not have the text cursor... this continues until the player selects a cell other than in column 1.
     
  9. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    [ deleting this post per further review in next message ]
     
    Last edited: Feb 10, 2017
  10. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Ok... this is getting embarrassing, but hopefully I've got this straightened out for you now...

    1. Remove the update to Cell.cs all together. Nix the code insert I gave you in my last post. (sorry)

    In Cell.cs between at rows 260 REMOVE:

    Code (csharp):
    1.  
    2.     if(this.row.datum != null && this.row.datum == this.table.selectedDatum &&
    3.        this.column != null && this.column == this.table.selectedColumn) {
    4.       this.table.inputCell.SetFocus(this);
    5.     }
    6.  
    2. At the very bottom of Cell.cs you'll see method OnPointerClick, please change it to this:

    Code (csharp):
    1.   public void OnPointerClick(PointerEventData data) {
    2.     if(this.element.datum.isHeader && this.table.headerActiveCallback != null)
    3.     if(!this.table.headerActiveCallback(this.column))
    4.       return;
    5.     this.HandleClick(data);
    6.   }
    3. At row 231 in Table.cs you'll see:

    Code (csharp):
    1. if(row != null)
    2.       row.SetColor();
    Replace that block with:

    Code (csharp):
    1.     if(row != null) {
    2.       row.SetColor();
    3.       if (c != null && c.isInput && !(row.datum.isHeader || row.datum.isFooter))
    4.         this.inputCell.SetFocus(row.cells[c.idx]);
    5.     }
    Let me know if you have any more issues, and if you don't I'll roll a proper patch for this right away.
     
    Last edited: Feb 10, 2017
  11. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Seems to be working OK now. I didn't really re-test problem (2), since the workaround reported in conjunction with problem (3) is needed for my application in any case.

    BTW, the standalone toy application I'm using to test this, prior to integration into the real app, has just 2 identical tables side by side. Each has a numeric text column and 2 input columns, plus vertical scroll only. When finalized, the idea is that either one can be the master, and the other the slave, and this can change during runtime. Only the master is editable, and the changes (text content, cell selection, vertical scroll bar location) sent "immediately" to the slave (via simple messages that would lend themselves, with further adaption, to messaging over a network.)

    In order to make this work, I needed to suppress the focus setting in the slave, but not the master. I added a new parameter, setFocusIfInput, to your Feb 11 patch of Table.cs:
    Code (csharp):
    1. if (row != null)
    2.   {
    3.   row.SetColor();
    4.   if (c != null && c.isInput && !(row.datum.isHeader || row.datum.isFooter) && setFocusIfInput)
    5.   this.inputCell.SetFocus(row.cells[c.idx]);
    6.   }
    and changed the function signature to include it:
    Code (csharp):
    1. [  public void SetSelected(Datum d, Column c=null, bool doCallback=true, bool animate=false, bool setFocusIfInput=true)
    Let me know if you'd be interested in this toy app as a test case, and if so I'll check with the powers that be, once it's stable. Mainly the master<->slave swap and touch suppression at the slave are to be done. I'm thinking just a glass shield for the latter.
     
  12. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Sure thing, I'd be happy to roll your test case here into the standard 'samples' and keep an eye on it's functionality as we roll future builds. PM a link if the powers that be sign off on that as well.

    Thanks!
     
  13. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    The "glass wall" idea didn't pan out, so instead I'm using a separate parent Canvas for each table, that has a Canvas Group component. Programmatically setting the "Block Raycasts" bool of the latter, to true for master, false for slave does the job. This is toggled during master <-> slave swap, which is done by touching the master's header.

    A remaining problem is that I'm differentiating master and slave by header normal color. When I programmatically change the color by table.headerNormalColor =... , the master-to-slave change happens right away (it's invoked within my OnHeaderClicked handler), but the slave-to-master change (invoked from a coroutine) doesn't. However, if I pass the mouse over the header (momentarily invoking hover), the color change will end up applied. Any thoughts on how I can force the recoloring? I tried Canvas.ForceUpdateCanvases() to no effect. Thanks.
     
  14. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Sort of a guess here without a sample scene to play with... but maybe try

    Code (csharp):
    1.  
    2. table.headerRow.SetColor();
    3.  
    when you want to force the color to update. My fear is that won't work in this instance because there are other status flags on the header row that probably haven't been set at this point in your UI flow, but it's worth a shot.
     
  15. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    That did work. See the private conversation for pointer to code.
     
  16. winsock

    winsock

    Joined:
    Mar 21, 2013
    Posts:
    3
    so, i want to use the dropdown let user select something in the table cell,how can i implement it ?
     
  17. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    The table Initialize method has a few different signatures. The one you want to implement is:

    Code (csharp):
    1.  
    2. public void Initialize(Action<Datum, Column, RectTransform> selectionCallback)
    3.  
    This will call your Action with the active cell's RectTransform as an argument (along with the current data row and column). You can then marry those three value together to overlay whatever UI widget you want at the same coordinates as the cell's RectTransform and implement any UI effect you need.
     
  18. winsock

    winsock

    Joined:
    Mar 21, 2013
    Posts:
    3
    Thank you reply so quickly!
     
  19. mdgameapp

    mdgameapp

    Joined:
    Mar 18, 2017
    Posts:
    3
    Hi @slumtrimpet
    How can i merge some ceil (Column and row merge ceil). So i can use to make some complicated apps.
    Thanks so much!
     
  20. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    That's not supported. You'd need to update the data in the rows or cells an emulate that functionality.
     
  21. SJ_Medical

    SJ_Medical

    Joined:
    Nov 1, 2016
    Posts:
    4
    I am using TablePro and I have two problems now.
    1. The scrolling area is blank and the table looks strange.
    スクリーンショット 2017-03-30 10.33.26.png

    2. When you tap on the header, the size will be reduced.
    スクリーンショット 2017-03-30 10.32.57.png
    Is there a solution?

    The image of a table with no blanks looks like this.
    I tried to separate it into a table with only headers and a table with only data, but when there is side scrolling, it is necessary to synchronize two tables, so if there is no scroll, this method You can use.
    スクリーンショット 2017-03-30 10.47.30.png

    Later, I would like to mention as a request,
    1. I want you to separate the alignment in the header, footer, DataRow.
    (Now, set by column)
    2. In the case of a long horizontal column, you want to always display the leftmost side fixed even if you scroll horizontally.

    Because I am using machine translation, please forgive me where English is funny.
     
    Last edited: Mar 30, 2017
  22. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Hi, I'm sorry.. I'm not understanding.

    Can you point out any of those items not working in the included samples so I can duplicate and try to fix? Clicking the header itself does nothing besides fire a callback so there's not really any way that's causing the table to resize unless your callback is manipulating the root RectTransform maybe?

    Do you have a sample project you could PM me? Please try to give me more info and I'd be happy to help, just not understanding the issue at this point.
     
  23. SJ_Medical

    SJ_Medical

    Joined:
    Nov 1, 2016
    Posts:
    4
    The first one was mistakenly putting it under Image.
    I will send you a sample project for the second case.
    (Since it contains TablePro, passwords are sent separately)
    (my unity version is 5.5.0p3)
    (password send slumtrimpet conversation)

    スクリーンショット 2017-03-31 10.16.12.png

    This phenomenon did not occur a long time ago in the previous version.
    Click on the rightmost header to resize it to the size set in the script. The same is true for the line selection, and the selection width changes when pressing and releasing your finger.

    スクリーンショット 2017-03-31 10.16.23.png
     

    Attached Files:

    Last edited: Mar 31, 2017
  24. Chambers_Zhao

    Chambers_Zhao

    Joined:
    Apr 23, 2015
    Posts:
    4
    Hi @slumtrimpet
    How can I dynamiclly generate sprite and put the sprite into table?What should I do?
     
  25. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Sorry for the delay in reply here, was out of town for the weekend.

    In Row.cs please move the two rows:

    Code (csharp):
    1.  
    2.     else if(this.datum != null && this.datum == this.table.selectedDatum)
    3.       this.background.color = this.table.rowSelectColor;
    4.  
    from below the
    Code (csharp):
    1. else if(this.table.IsPointerOver(this)) {}
    block at about line 150 to above it.

    In Table.cs change row 109 from:

    Code (csharp):
    1.  
    2.     if(old != null)
    3.  
    to:

    Code (csharp):
    1.  
    2.     if(old != null && old.datum != null && !(old.datum.isHeader || old.datum.isFooter))
    3.  
    Let me know if that resolves your issues. These fixes will be included in next release if so.
     
  26. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Check out KitchenSink.cs included in the asset Samples directory. You see the "this.spriteDict" instantiation there and how it's passed to the table? You'd just instantiate the base sprite dictionary for your project with sprites from whatever source you want (either static assets or dynamic texture draws or whatever).
     
  27. SJ_Medical

    SJ_Medical

    Joined:
    Nov 1, 2016
    Posts:
    4
    thank you for your answer.
    Japan was also a holiday so there is no problem at all.

    There was no problem when the header was selected.

    However, as the action when Row is selected, not all the rows are selected, it will only be colored until the end of the column, so I feel that it is not apparently the length of the header. Can I make selected color or down color to the length of the table? Since it does not become selected color until the end of the column, it feels unnatural.
    (It occurs only when the length of all columns is shorter than the width of table)
     
    Last edited: Apr 4, 2017
  28. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    I'm thinking maybe I didn't explain one of the 'patch' lines in my last post. So are you not seeing the below? It's looking good to me now but I might not be understanding the issue.

     
  29. SJ_Medical

    SJ_Medical

    Joined:
    Nov 1, 2016
    Posts:
    4
    I was sick and was absent from the company, so my reply was delayed.
    With my misunderstanding,

    I moved it instead of copying it.

    This is all right now.
    Thank you very much.
     
  30. Chambers_Zhao

    Chambers_Zhao

    Joined:
    Apr 23, 2015
    Posts:
    4
    screnshot.png I want to make like the image above .How to do ?The cell merge ?
     
  31. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    You can't in base TablePro. We don't support cell merge.
     
  32. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    There's some new fatal difficulty using Table Pro with Unity 5.6, that had worked under 5.5. In Control.cs, getting errors in OnBodyScroll, due to table.bodySizer.localPosition.x being NaN.

    Also lots and lots of:
    Assertion failed on expression: 'IsFinite(outDistanceForSort)'

    This is with our code, similar to the sample test case I uploaded earlier to you, that uses input fields with tables in world coordinates. As you may recall, there were custom patches to support that. I revisited those patches in the context of your latest version (downloaded here 4/17), and only needed to reapply my patch to Table.cs; the rest of the files are as you now ship.

    Help, please. Thanks
     
  33. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    With further testing, can briefly get table to appear (by setting scaling within canvas to 0.95 instead of 1), and edit for a while, but if I navigate (with up arrows that call MoveUp) to the top data row, then it suddenly fails again... screen goes mostly blank, and the console errors noted above reappear in great number. Presumably related to scrolling.
     
  34. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Sorry for the delay in response here... been buried on other items.

    I tried all the TablePro samples with Unity 5.6.0p1 and they work fine for me. I'll need your help remembering what local changes you've made to Table.cs so I can experiment and see what is breaking.

    TablePro has also had several updates since our last commit to the AssetStore as well, so let me PM you a link to the most recent revision to test with. It's possible something else we've fixed might address the issue you are seeing already. Please grab the test version from your PM's and re-apply any changes you need in Table.cs and let me know how it works.

    Also, please re-send your resulting Table.cs so I can try and roll it into the base product (sorry, I know we tried to coordinate that last time we had an issue but I guess I dropped the ball here and didn't get your changes pulled into our trunk).

    Thanks

    [[EDIT: PM Sent]]
     
  35. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    I replied in a PM, with the Table.cs patch
     
  36. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Got it. I've now rolled that patch into the base trunk. Let me know when you get a second to test the patch I sent you with the patch you sent me. Seems to work fine for me. If you agree, I'll pinch off a build and push a fresh rev to the Asset Store.
     
  37. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    BAD NEWS:
    I tested the Table Pro beta you offered with my actual 5.6 project, and it made no difference in the severe bug I was seeing, which usually manifests itself as the world-view table contents not appearing (entirely white except horizontal line between header and body). Depending on how I diddled things, it was like this at the outset, or was good at first, then failed randomly while moving vertical thumb. Whether or not a cell had focus made no difference; nor any obvious relationship of avatar (and its camera) distance from table. Upon fail, Unity would report multiple instances of the following errors in the log:
    1) "transform.localPosition assign attempt for 'HeaderRow' is not valid. Input localPosition is { NaN, 0.000000, 0.000000 }." Also same error reported about assign attempt for 'Content'. In both cases, this was due to bodySizer.localPosition.x being NaN in your code.
    2) "Assertion failed on expression: 'IsFinite(outDistanceForSort)' ". These errors were associated with rendering of game view camera within the editor.

    There were some earlier forum reports suggesting these problems were associated with particular fonts used with TextMesh, but my limited font experiments did not solve that.

    SLIGHTLY BETTER NEWS:
    After much experimentation, I now attribute these problems to Scale settings in the parent canvas (and probably not specifically 5.6). You recall the input master/slave tables sample code I sent you earlier. If you compile it under 5.6, it works fine as before. However, if you make the following changes, you can reproduce the above problems.

    For Canvas1 and Canvas2 (the parents of the 2 table instances), change the Scale from {1,1,1} to {0.01,0.01,1}
    Move the now much smaller canvases closer together and nearer the plane. New position values are {166.1,365,480} and {160,365,480}
    Adjust the main camera closer to them, with both in view: Position = {162.7183,364.0463,471.3448}, rotations 0

    On run, the errors reported above will immediately begin. I was seeing 1 table blank, and the other rapidly jumping around with partial attempts at writing/scrolling.

    I don't know if these are fixable by you, or only by Unity. But they do manifest in your objects. I'll continue to search for a work around for my project, but am not optimistic. I hope you have better hunting.
     
  38. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    I tried shifting scaling from the parent canvas to the child table, made no difference. Nor adjustments to Canvas Scaler component.

    In another experiment, I tried reducing the scaling a bit, and ended up with an error manifestation that you may find more tractable to debug. In the same sample code as before, use these settings:

    For Canvas1 and Canvas2, change the Scale of both to {0.05,0.05,1}
    For the child tables, change the Scales to {1,1,1}
    Slide Canvas1 to {163,365,480}, Canvas2 to {195,365,480}
    Readjust main camera, e.g. around {180,364,444}

    When you run (within the IDE), at first everything will be fine. Move the vertical scroll thumb up and down a few times... eventually it will run out of control, continually cycling the thumb and table visually throughout the first "page" of rows. In the MyTableScript.cs code, this cycling of table.bodyScroller.verticalNormalizedPosition is reported to the command Window (at line 326+).

    Unlike the previous case, there are no NaN's generated, or any errors reported. Just endless cycling.

    As just described, this is easier to trigger in non-full-screen mode. In full-screen, easier to trigger if you select an input cell and then move up and down rapidly, hitting the up/down arrow keys.
     
  39. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Hey man, I don't believe I have the "MyTableScrip.cs" file you refer to in your last post. Can you send another PM with that and a scene I can test on? I'm sorry about this.

    Also, I did notice some items in the last few Unity5.6 patch releases that sound suspiciously close to what you are describing. Specifically this one in 5.6.0p3:

    https://issuetracker.unity3d.com/is...d-via-script-and-canvas-is-scaled-to-0-dot-01

    What editor rev are you using?
     
  40. jsmythe

    jsmythe

    Joined:
    May 6, 2017
    Posts:
    1
    Is there any way to manually resize a column (e.g., hold finger or stylus at left or right sight side of column heading and then drag)?
    If there is a lot of text in a cell, is there any way to provide a horizontal and/or vertical scroll bar and just display part of the text?
    Does the data for headings and cells have to be set one at a time or do you support other formats (e.g., JSON, XML, CSV, etc.).?
     
  41. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    See today's PM for the updated link to the test project, built under 5.6.0f3 and reflective of my post above of last Monday. (You can also change the scaling factors to those given in the "SLIGHTLY BETTER NEWS" section of my April 29th post to recreate the more severe errors.)

    I agree that the Unity issuetracker post you pointed to is pertinent and possibly causative. It is unfortunate that it is claimed in the issuetracker page header to be "fixed in [Unity beta] 2017.1" but a respondent says it's not, nor do we have an estimated non-beta release.

    BTW, is there any way to change (at table design or initiation time) the width of the thumb of the vertical scroller? Could this be provided in the future?
     
  42. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    No, no way to manually size individual columns currently. The engine sizes the columns for you to fit the content.

    No scrollbars on individual cells (again, engine sizes the cells so no need).

    The data in the table is just a c# List. How you get your source data (json/xml/csv) into said List is not in the scope of what the asset does and is up to you to implement however you wish.
     
  43. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Thanks so much for sticking with this and providing the sample project.

    First off, I'm not seeing the issue from your May 1 post still:

    When you run (within the IDE), at first everything will be fine. Move the vertical scroll thumb up and down a few times... eventually it will run out of control, continually cycling the thumb and table visually throughout the first "page" of rows. In the MyTableScript.cs code, this cycling of table.bodyScroller.verticalNormalizedPosition is reported to the command Window (at line 326+).

    I happen to be running Unity editor on MacOS... no idea if that would account for my not seeing this issue but curious if that's still a difference between our test setups.

    BUT... I was definitely able to reproduce the "SLIGHTLY BETTER NEWS" error from your Apr 29 post and verified that it's broken in 5.6.0f3, 5.6.0p1, 5.6.0p2, but FIXED in 5.6.0p3 (that's where the bug fix first appears for the issue link I posted above).

    Any chance you can test your May 1 issue on 5.6.0p3 or 5.6.0p4 and see if it's resolved there? It is looking like that's purely a low level Unity bug that they've since fixed.

    Things are running (I think) perfectly for me now in p3:



    RE: the scrollbar thumb width setting... yes that's been implemented in current trunk. Let me check the status on that and I'll PM you an update.
     
  44. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    PM sent with build supporting settable thumb sizes. (also pushed the same build containing ALL our recent stuff to Unity for acceptance on the store)
     
  45. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Thanks, I also confirm Table Pro in the above test project (and my real project) is working for me under 5.6.0p4. Wonderful! (I noticed Unity just released 5.6.1, haven't tried that yet.)

    Only minor hiccup seen... the normalized vertical scroll thumb location, which should be constrained to 0.0 .. 1.0, was once seen (in my debug statements) as slightly higher... something like 1.006. Sorry, I didn't record it, and its not reproducible. Didn't really cause a problem.

    Thanks too for the link to the next version of your code. Sorry I haven't had a chance to look at it, been busy elsewhere... so it might hit the Unity Store first before I can play with it.
     
  46. toph_er

    toph_er

    Joined:
    May 26, 2017
    Posts:
    4
    Hey Slum,

    I have been building a menu system that includes tables. I've been using your Table Pro to do that. The actual scene that I'm using has been built into an AssetBundle and gets loaded into my game scene. It starts out inactive, and when I click on the tab that has the table I call the OnEnable() function. I've tried different methods of initializing the table but it just doesn't want to load properly. Problem is that the table loads the background, the spinner (which isn't spinning). That's about it.

    If I disable that tab and then re-enable it the dividers and header with no text shows up. The text is present in the Hierarchy of the game objects, and it shows the header and its text attached, but isn't showing. It's so strange that it works as its own project, but when loading this scene as an additive, the table breaks.

    Re-enabling further doesn't do anything. When using it in its own project it works fine. But it seems like streaming the asset doesn't like the draw calls? I'm not really sure. I have a feeling it has something to do with loading the scene.

    Any help would be excellent.

    If my explanation isn't very good I will try to clarify.

    Thanks,

    Topher

    UPDATE: Decided to make a new Unity Project with nothing in it to test loading an additive scene. It works. So something weird in the project I have is stopping it from drawing properly, or something. Doesn't seem to be anything wrong with Table, just seems incompatible with the project I'm working with. Great.... -.- haha.

    UPDATE 2: Tried it on a colleague's computer. It works. Just doesn't draw properly on mine. Even better.

    UPDATE 3: Well, looks like when the game's time scale is set to 0 your tables don't update properly. Might want to investigate other options, or keep it. I have a work around.
     
    Last edited: May 29, 2017
  47. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Hi toph_er, sorry for the delayed reply here. Was out of the office for long US holiday weekend. So reading through the journey you went on here with the table adventures, are you good for now then? Don't want to leave you hanging, so want to make sure I understand your "update 3".

    Thanks!
     
  48. toph_er

    toph_er

    Joined:
    May 26, 2017
    Posts:
    4
    Hope your holiday went okay.

    I am building a maitenance menu for a project. This requires some tables. We decided to purchase your asset instead of building it ourselves. Problem is that when we pause the game, we set our time scale to 0. This causes the fade on the loading overlay to not work properly since it is based on unity's Time class. We pretty much just stopped the fade overlay function call and just hid the overlay instead of fading it over time.

    Edit: Okay so another smaller issue here. If I set the Table's gameobject to inactive and back to active the header's last column isn't the proper width and the color seems off.



    Both restriction booleans are enabled to force width to be the whole table always.. but changing them to either doesn't help.
     
    Last edited: May 30, 2017
  49. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Greets.
    I've returned to this project, and finally got Table Pro content working with UNet with 5.6.1f. (I haven't tried the latest Table Pro version you sent me, which I guess is in the Store now too.)

    FYI, this required some fiddling. In particular

    1) I had to add the sender (player name) to propagated messages, so that I could properly screen out messages from myself (and didn't need to be reapplied to the Master table).

    2) It was odd that, if I my function OnInputFieldChange tries to propagate the value to other clients, it doesn't happen in some cases. It works fine if a non-hosting machine is table Master, but when the hosting machine is Master, the string update (set in motion by my SendToOtherTables function) is not being received by the syncvar on a remote client. Maybe this is due to UNet authority issues associated with OnInputFieldChange call? Dunno. Contrast that with other functions (not shown: OnTableSelected(Datum datum, Column column), various functions called from Update that move the input cell selection in response to user keystrokes), where you can successfully call SendToOtherTables() directly

    My workaround was to have OnInputFieldChange post the string update to the Update() function [via a private string passAlongOnMyTableChangedMsg], which could then call SendToOtherTables and have it work reliably. So I'm just mentioning all this in case someone else runs into this issue.

    For those interested in details, below is much-simplified pseudocode (with renaming to reflect the sample input project) to sketch the setup further. Sorry, can't give out the real/complete code.

    Code (CSharp):
    1. // File UNetUserControl.cs:
    2.  
    3.     public class UNetUserControl : NetworkBehaviour
    4.     {
    5.         //...
    6.         [SyncVar(hook = "OnMyTableChangedHook")]
    7.         public string MyTableMessage;
    8.  
    9.         private MyTable m_MyTable; // to MyTableScript.cs, within Standard Assets
    10.         // Not shown: initialization of m_MyTable in Start()
    11.  
    12.         // ...
    13.         void OnMyTableChangedHook(string newMessage)         // Syncvar hook function.
    14.  
    15.             // DOESN'T WORK IF NON-HOST PLAYER:
    16.             //if (isLocalPlayer)
    17.             //    return; // Already done locally
    18.             // Instead, rely on checking of sender player name (included within newMessage) in next call
    19.  
    20.             m_MyTable.OnMyTableChanged(newMessage);
    21.         }
    22.  
    23.         [Command]
    24.         void Cmd_ProvideMyTableMessageToServer(string msg)
    25.         {
    26.             MyTableMessage = msg;
    27.         }
    28.  
    29.         [ClientCallback]
    30.         public void TransmitMyTableMessageIfLocalPlayer() // make public to call from MyTable script
    31.         {
    32.             if (!isLocalPlayer)
    33.                 return;
    34.  
    35.             Cmd_ProvideMyTableMessageToServer(MyTableMessage);
    36.         }
    37.        // ...
    38.     }
    39.  
    40. In MyTableScript.cs:
    41. public class MyTableScript: MonoBehavior
    42. {
    43.     // ...
    44.     [HideInInspector]
    45.     public UNetUserControl m_UNetUserControl; // Initialization in Start() not shown
    46.  
    47.     private string passAlongOnIncidentLogChangedMsg = ""; // stupid hack
    48.     // Not shown: m_PlayerName and it's initialization
    49.  
    50.     void Start()
    51.     {
    52.        // ...
    53.         table.AddTextColumn(null, null, 25, 25);
    54.         table.AddInputColumn(OnInputFieldChange, "First Input Column", null, 70, 70);
    55.         table.AddInputColumn(OnInputFieldChange, "Second Input Column", null, 265, 265);
    56.         // ...
    57.     }
    58. ...
    59.     private void SendToOtherTables(string msg)
    60.     {
    61.         // comma separated format, 4 formats:
    62.         // where Sender is player name and has no commas
    63.         // sender,colnum,rownum,"new content"
    64.         // sender,colnum,rownum        means set selection to that cell (but not focus, because slave)
    65.         // sender,float between 0.0 and 1.0    means vertical scrollbar normalized position, 1.0 = top
    66.         // sender,various state keywords without commas
    67.             m_UNetUserControl.MyTableMessage = msg;
    68.             m_UNetUserControl.TransmitMyTableMessageIfLocalPlayer();
    69.     }
    70.  
    71.     OnMyTableChanged(string newMessage)
    72.     {
    73.     // Lots of parsing, not shown here. At start, the first csv field is checked, and if it's the
    74.     // name of the local player, return
    75.     }
    76.  
    77.     private void OnInputFieldChange(Datum d, Column c, string oldVal, string newVal)
    78.     {
    79.         // PROBLEM (when hosting machine is master, this string not being received by syncvar on remote client...
    80.         // Maybe problem with permissions associated with OnInputFieldChange call?
    81.         // SendToOtherTables(m_playerName + "," + c.idx + "," + d.uid + "," + newVal);
    82.         passAlongOnIncidentLogChangedMsg = m_playerName + "," + c.idx + "," + d.uid + "," + newVal;
    83.     }
    84.  
    85.     public void Update()
    86.     {
    87.  
    88.        // ...
    89.         if (!String.IsNullOrEmpty(passAlongOnMyTableChangedMsg))
    90.         {
    91.             SendToOtherTables(passAlongOnMyTableChangedMsg, true);
    92.             passAlongOnMyTableChangedMsg = "";
    93.         }
    94.        // ...
    95.        }
    96. }
     
  50. geep_

    geep_

    Joined:
    Apr 18, 2016
    Posts:
    25
    Other issues.
    1) What's the best way to unselect a table cell, that is, unselect the entire table? table.inputCell.RemoveFocus() doesn't do it (e.g., doesn't revert cell & row colors to unselected state).
    2) If I set the selected cell programmatically, is there some already-provided way to scroll the selected cell into view? (I'm working on a routine to do that, assuming the answer is no, but it's not yet working right.)
    3) Can I suppress mouse-over coloring? Currently, if I've got a row that's selected (let's say the selected cell is yellow and the other cells in the row are orange), and the mouse is over a non-selected cell in the selected row, then the mouse-hover color (e.g., gray) is shown for non-selected cell, whereas I'd prefer mouse-hover to be ignored.