Page 1 of 3
Hilite Form Grid row based on time field
Posted: Tue Mar 12, 2019 6:09 pm
by tbcomputerguy
Is it possible to have a grid row hilite based on a time field in the data from an sqlite database. In other words
as you can see there is a time that is displayed. Can the row be highlited when that time is compared to the internal time. BTW, i have now coding experience, an absolute beginner. I have managed to create the interface of the dances through lots of reading and watching. But as of yet had no luck extracting the current row data when clicked..(another post later)
Dave
Re: Hilite Form Grid row based on time field
Posted: Tue Mar 12, 2019 6:38 pm
by dunbarx
Hi.
I can at least help a little with the time test. In a button script:
Code: Select all
local targetTime
on mouseUp
ask "What time to Report?"
convert it to seconds
put it into targetTime
checkTheTime targetTime
end mouseUp
on checkTheTime tTime
if the optionkey is down then exit to top
if the seconds > targetTime then
answer "It's time!" -- your code here
exit to top
end if
send "checkTheTime" && the seconds to me in 1
end checkTheTime
The optionKey line is just an escape.
I do not know what you like to use to display the time, so you may have to play with the "ask" line. In the US, I would, as written, get something like "1:30 PM". Be careful of the format.
Anyway, this will trigger the answer dialog when the time passes the FUTURE moment you set. The handler will run in the background forever in the current session, including if you open another application and work there.
Craig Newman
Re: Hilite Form Grid row based on time field
Posted: Tue Mar 12, 2019 6:47 pm
by dunbarx
Rereading your post, you can get the hilited row in a DG by putting this in the group script or anywhere:
Code: Select all
on mouseUp
answer the dgHilitedLines of grp "yourDataGrid"
end mouseUp
And you can set the hilitedLine similarly, perhaps in a button script, or anywhere at all:
Code: Select all
on mouseUp
set the dgHilitedLines of grp "yourDataGrid" to 3
end mouseUp
Craig
Re: Hilite Form Grid row based on time field
Posted: Tue Mar 12, 2019 7:50 pm
by tbcomputerguy
The times you see are not calculated. they are from the data...in this case, the time of that particular dance. What is happening is my daughters go to these dance competitions and get some program book with 60 pages of dances in it. pain in the ass to find my daughters dances out of 1200 dances. anyhow my goal is to create and app to replace the book, even if it is for me. We get the data in usually pdf format, which i convert to excel...at least for now. I will import that into sqlite then recompile with new data. I am using data from last year. I have set it up with mysql as well. and got that working but my isp gives us routers for home that I can't for the life of me open a port to test it...i have it working locally.
Sorry back to this. On progam load or data load, i ask the program to put the time in a field (not show in the above pic)
Re: Hilite Form Grid row based on time field
Posted: Tue Mar 12, 2019 10:00 pm
by dunbarx
Why do all that? Why not keep it in LiveCode? Do others access that data?
Craig
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 2:13 am
by tbcomputerguy
By "do others access the data" do you mean via other electronic means then no! There is a pdf version of the book that each studio gets. I got a copy last year by asking the studio director. I wanted to see if the pdf could be exported to excel or excel extracted from the pdf, but either way it was. So I played with the data and developed some stats with it but that was all. What do you mean "keep it in livecode" There will be no additions after the schedule is final, they (the dance competition committee) produce the books then sell them at the event. I believe this will be very functional all events, so I am going at this slowly...card by card.
Dave
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 5:07 pm
by dunbarx
I am curious why you are going to the extra trouble of using an sqLite database.
If this is not for multi-user access, or perhaps very large files, or to use the functionality of an external SQL database, then I think that everything you want to do can easily be done in a single stack, likely on a single card.
Many users automatically assume that these fancy resources (DataGrids are another example) are used in LC as a matter of course. I never have used an SQL gadget, and hope never to have to.
So, you might well use a DG for its display prowess. But why sqLite?
Craig
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 5:45 pm
by tbcomputerguy
Ok, i have another project that i want to do at a later time, so I am doing this for the learning aspect. Makes sense, just import a tab delimited file into the grid. now you have me thinking. Is this the approach i should be taking. I want the user to click on a row and see the current info on another screen. I guess this way there is no sql to use. just the dgDataOfIndex and the dgDataOfLine properties...correct

But to do that i think i need more than one card.
Dave
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 5:57 pm
by Klaus
Hi Dave,
tbcomputerguy wrote: ↑Wed Mar 13, 2019 5:45 pm
But to do that i think i need more than one card.
not neccessarily, you can put the appropriate fields for the details above or below the datagrid itself. This is how many apps do this.
Best
Klaus
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 5:58 pm
by dunbarx
Dave.
My goal always is to remain inside LC at all costs. In one area, I have a handful of users that both read and write to external files on a server, that data being available to all of them. That is as far out of LC as I need to go. In that way, each instance of their local standalone is just a front end to that dataset.
Two cards is not too onerous. That is a matter of style and look and feel.
As for learning, well then, go all out. But I would build the gadget first, and then embellish, as opposed to the other way around.
Craig
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 6:52 pm
by tbcomputerguy
Each stack contains one or more sets of information called cards. Each card can have a different appearance or all the cards in a stack can look the same. By going from card to card in a stack, you change what's being displayed in that stack's window.
that is from the how to structure you app. So i thought using cards was the way to to go..each card is a screen. the second card in my app will display more info then on the list of dances. I have chosen to to add the dancers on that screen because one dance type called production can have up 40 dancers.
Dave
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 8:20 pm
by FourthWorld
tbcomputerguy wrote: ↑Wed Mar 13, 2019 6:52 pm
I have chosen to to add the dancers on that screen because one dance type called production can have up 40 dancers.
Does your app involve Labanotation?
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 8:58 pm
by tbcomputerguy
Nope, the app will be used by parents only and the dancers. The judging is done separately. As it is, the books as mentioned earlier, just show the dance and time etc. see pic attached. There is a date at the top of the page not printed. See the bottom act has numerous dancers.
Re: Hilite Form Grid row based on time field
Posted: Wed Mar 13, 2019 11:43 pm
by dunbarx
I would use a table field and a few buttons.
We can walk you through this.
Craig
Re: Hilite Form Grid row based on time field
Posted: Thu Mar 14, 2019 2:01 am
by tbcomputerguy
i will read up on it and i will give it a shot...can't learn if i don't try. Ill keep you posted.
Thanks for the help.
Dave