- Your solution is clever , and
- it appears to supply a work around to the issue, and
- your thinking is valid (it is weird to me also, but I lack enough knowledge to know exactly why, so weird more in a "curiosity" way).
Table Field not updating correctly
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Table Field not updating correctly
Well, using IDEs so far back in the chain as I do, I haven't had to think about it much but I think -
Re: Table Field not updating correctly
Looking at the code, I can see why arrow keys work. Knowing that should make finding a solution easier. I kind of doubt that it is random, I’m guessing there will be a pattern too.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Table Field not updating correctly
I think so too. Something "sticks" in the innards of a table field when a "cell" has had something put into it. The craziness occurs upon exiting the "phantom" field LC creates to simulate text entry in a "cell". The team should be able to isolate the problem readily.I kind of doubt that it is random, I’m guessing there will be a pattern too.
So many parenthetical words in this discussion.
Craig
Re: Table Field not updating correctly
There is code (handlers) to go to the next/previous row/cell (one for each direction). When navigating that way, tabs are automatically inserted. My guess is that something is amiss with the calculation of tabs that need to get inserted when clicking on an arbitrary cell. The location is good in one sense because it puts the virtual cell (field) where it needs to go, but then the data does not end up in the correct spot.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
Re: Table Field not updating correctly
Ahhhhhhh, thank you for the explanation Brian! That makes it a lot clearer (for me anyway).
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Table Field not updating correctly
Brian is likely on to something.
And maybe that is why it matters if a "cell" has (or has not) been pre-loaded under script control. There are no phantom fields and none of the concomitant messages generated by user action. The tabs are "loaded" via a different methodology (a handler), and somehow those tabs stick, "stabilizing" the table field.
Craig
And maybe that is why it matters if a "cell" has (or has not) been pre-loaded under script control. There are no phantom fields and none of the concomitant messages generated by user action. The tabs are "loaded" via a different methodology (a handler), and somehow those tabs stick, "stabilizing" the table field.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Table Field not updating correctly
After I saw a reference to this thread I had a look at the problems of manually inserting data into a table field via "cell edit"
bogs wrote
Indeed that is the root of the problem of manually entering data via "input field"
automatically creating items when setting the htmlText of a non-existent item fails starting version 7 of LC.
I did a patch for stack "revTableLibrary" that fixes the problem for the table field.
Those who feel adventurous can fix it temporarily by replacing the handler "revWriteCellField" in stack "revTableLibrary" with below code. The patch is marked.
You can open the stack "revTableLibrary" by using the Project Browser and start replacing handler "revWriteCellField"
Stack "revTableLibrary" is also listed in the front scripts -> Project Browser.
If you quit LC the changes will be gone and you would have to apply the patch again next time you open LC.
In my testing it works. More people testing this would be welcome.
I will do a separate bug report for this and propose the fix, if accepted I will do a pull-request.
Kind regards
Bernd
bogs wrote
reported dec 2016.I did find this bug report https://quality.livecode.com/show_bug.cgi?id=18983, but aint sure if it is the same thing or not.
Indeed that is the root of the problem of manually entering data via "input field"
automatically creating items when setting the htmlText of a non-existent item fails starting version 7 of LC.
I did a patch for stack "revTableLibrary" that fixes the problem for the table field.
Those who feel adventurous can fix it temporarily by replacing the handler "revWriteCellField" in stack "revTableLibrary" with below code. The patch is marked.
You can open the stack "revTableLibrary" by using the Project Browser and start replacing handler "revWriteCellField"
Stack "revTableLibrary" is also listed in the front scripts -> Project Browser.
If you quit LC the changes will be gone and you would have to apply the patch again next time you open LC.
In my testing it works. More people testing this would be welcome.
I will do a separate bug report for this and propose the fix, if accepted I will do a pull-request.
Kind regards
Bernd
Code: Select all
on revWriteCellField pObject
--revSetScrollInfo pObject
put the cREVTable["currentxcell"] of pObject into txcell
put the cREVTable["currentycell"] of pObject into tycell
put the cREVTable["currentview"] of pObject into tCurrentView
put revGetCellName(pObject) into tFieldName
if there is not a field tFieldName then exit revWriteCellField
put the long ID of field tFieldName into tFieldRef
put the text of field tFieldName into tNewText
put the htmltext of field tFieldName into tNewHtmlText
-- now that we have what we need, abuse the temp field a bit *chuckle*
lock screen
lock messages
-- if the currentview is not yet in htmlText, make sure to convert it
if isHTML(tCurrentView)
then set the htmltext of field tFieldName to tCurrentView
else set the text of field tFieldName to tCurrentView
set the itemDelimiter to tab
# Patch for bug 18983
if the number of items of line tycell of field tFieldName < txcell then
put empty into item txcell of line tycell of field tFieldName
end if
# end patch
put the htmltext of item txcell of line tycell of field tFieldName into tCurrentHtmlText
if tCurrentHtmltext contains "#9;" then
put "<p></p>" into tCurrentHtmlText
end if
## NOTE :: DO NOT REMOVE THE LOCK MESSAGES OR YOU'LL GET AN ERROR AFTER SETTING THE HTMLTEXT !!!
if not (tNewHtmlText = tCurrentHtmlText) then
set the htmltext of item txcell of line tycell of tFieldRef to tNewHtmlText
set the cREVTable["currentview"] of pObject to the htmlText of tFieldRef
try -- this has to be try because there may not be a database library in a standalone
send "revUpdateDatabase pObject,txcell,tycell,tNewText" to pObject
catch tError
end try
end if
-- and unlock things again
unlock messages
unlock screen
-- move on with the other updates
revUpdateScrollInfo pObject
revDisplayFormattedData pObject
if exists(pObject) then
send "revUpdateCellValue pObject,txcell,tycell,tcurrentcell,tNewText" to pObject
end if
end revWriteCellField
Last edited by bn on Mon Nov 05, 2018 8:50 pm, edited 1 time in total.
-
- Posts: 253
- Joined: Wed Aug 19, 2015 4:29 pm
Re: Table Field not updating correctly
This fix is working here in LC 9.01 on Ubuntu 18.04. The only difference, is the stack with the "revWriteCellField" handler is actually named "revTableLibrary"
Thanks!
Thanks!
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Table Field not updating correctly
Thanks for testing.
Will correct it in the post.
KInd regards
Bernd
Some day I will do a post without goofing it up, promised....The only difference, is the stack with the "revWriteCellField" is actually named "revTableLibrary"
Will correct it in the post.
KInd regards
Bernd
-
- Posts: 253
- Joined: Wed Aug 19, 2015 4:29 pm
Re: Table Field not updating correctly
I wasn't 100% sure whether or not the stack had a different name based on platform. Either way, thank you for the fix, it's much appreciated.
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Table Field not updating correctly
Bug reported:
https://quality.livecode.com/show_bug.cgi?id=21679
open for comments
Kind regards
Bernd
https://quality.livecode.com/show_bug.cgi?id=21679
open for comments
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Table Field not updating correctly
Pull-request
https://github.com/livecode/livecode-ide/pull/2010
the pull-request is against develop 9.0 which means that it should/could be included in 9.0.2 rc1 if the pull-request is accepted in its current form.
Kind regards
Bernd
https://github.com/livecode/livecode-ide/pull/2010
the pull-request is against develop 9.0 which means that it should/could be included in 9.0.2 rc1 if the pull-request is accepted in its current form.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Table Field not updating correctly
I just checked a new table field. The issue remains. I have not tested Bernd's offering, But this, applied to a new table field immediately after creation, still works:
This assumes that 200 is adequate for the use case.
Craig
Code: Select all
on mouseUp
set the itemDel to tab
repeat with x = 1 to 200
repeat with u = 1 to 200
put "" into item u of line x of temp
end repeat
end repeat
put temp into fld "yourTableField"
end mouseUp
Craig