Problem with Table in application

Hello all :slight_smile:

Here, I have a rather odd problem which I do not manage to solve (and I would have liked to find a solution rather quickly).

Before launching this topic, I consulted the various already covered subjects approaching handling with the “table view”, for exemple:

But, unfortunately, even while taking your advice, I always have the same problem: the “table view” does not want to however post the data that I communicate to him, there are well two lines which are created, but they remain always empty… would you have an idea of the reason of this problem and how to solve it?

Here the code which poses problem (but I do not know where):

on will open theObject
	tell theObject to center
	set Fen to name of theObject

	if Fen is "FenScores" then
		tell window "FenScores"
			set TableView to table view "TablVwScores" of scroll view "ScrllVwScores"
			set DataSource to data source of TableView

			tell DataSource 
				try
					delete every data row
				end try
				try
					delete every data column
				end try
				
				make new data column at the end of the data columns with properties {name:"nom"}
				make new data column at the end of the data columns with properties {name:"niveau"}
				make new data column at the end of the data columns with properties {name:"mode"}
				make new data column at the end of the data columns with properties {name:"score", sort order:descending, sort type:alphabetical}
				
				set sorted to true
				set sort column to data column "score"
			end tell
			
			set TableData to {{nom:"Fredo", niveau:"D�butant", mode:"Cach�", score:"22 clics"}, �
				{nom:"Yvan", niveau:"D�butant", mode:"D�couvert", score:"42 clics"}}
			
			append DataSource with TableData
			tell TableView to update
		end tell
	end if
end will open

Thank you very much for your assistance.
:wink:

Modifying your code just slightly works for me (although I didn’t try what your posted):

on will open theObject
    tell theObject to center
    set Fen to name of theObject as string
    
    if Fen = "FenScores" then
        set TableData to {{nom:"Fredo", niveau:"D?butant", mode:"Cach?", score:"22 clics"}, ?
            {nom:"Yvan", niveau:"D?butant", mode:"D?couvert", score:"42 clics"}}
        
        set TableView to table view "TablVwScores" of scroll view "ScrllVwScores" of theObject
        set DataSource to data source of TableView
        tell DataSource
            try
                delete every data row
            end try
            try
                delete every data column
            end try
            
            make new data column at the end of the data columns with properties {name:"nom"}
            make new data column at the end of the data columns with properties {name:"niveau"}
            make new data column at the end of the data columns with properties {name:"mode"}
            make new data column at the end of the data columns with properties {name:"score", sort order:descending, sort type:alphabetical}
            set sorted to true
            set sort column to data column "score"
            append with TableData
        end tell
        tell TableView to update
    end if
end will open

I made a quick demo app to prove it:

[url=http://homepage.mac.com/jonn8/as/dist/FredoTable.hqx]http://homepage.mac.com/jonn8/as/dist/FredoTable.hqx[/url]

Jon

Hi Jon :slight_smile:

Thank you very much for this fast answer. :smiley:

I tested the code displayed in your message, but that still does not function.
I then launched the application which you made for me (how you to thank?), but there either, no result. Here what I obtain:

What makes me think that, probably, the problem is at the level of the system.
I will try to start again my computer and to test the various codes again… I keep you informed.

Thank you still Jon for your assistance. :wink:

PS. I could not publish your project since I work still with the old version of ASStudio (OsX 10.2.6), but I could anyway open the file “FredoTable.applescript” with the script editor beta 2.

Really, I do not understand this problem. :? :?

I restarted (again) my computer, but without any result, I always have the empty table, as well in my project, in your Jon.
However, when I use the examples provided with ASStudio, “Table” and “Table sort”, they work perfectly.

It is really bizarre… I spent the day to be tried to find a solution, but for nothing… :cry: :cry:

Thank you Jon for your assistance, if you, or somebody else, has an idea of the cause of this problem, do not hesitate to say it, that will help me very much…

Thank you for all. :wink:

I don’t know what to tell you because the code I posted does indeed work on my machine. In fact, your original code also works properly on my machine. I am running 10.3.2 & Xcode 1.1. After you compile your app, run it and then, via the Script Editor, try to extract the data from table. I suspect that it is indeed appending the data to the data source but there may be something like a font conflict that is preventing the text from actually being displayed.

Good luck,
Jon

Hi :slight_smile:

I did not find a solution with my problem.
I will advance on my project, and when it is usable, I would propose it on the forum beta-tests, in this manner I could check if the problem come from my computer, or of a bad design of my application.
In any case, thank you very much Jon, for all your help.
:wink: