Tooltip question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Tooltip question

Post by marksmithhfx » Sat Nov 05, 2011 3:27 pm

Hi, is there a tooltip property for Data Grids?
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Tooltip question

Post by mwieder » Sat Nov 05, 2011 6:19 pm

A data grid is a group. I set tooltips on some individual items in a datagrid when I place them in the grid. What are you trying to accomplish?

update: if you need to set a tooltip on the whole datagrid, try something like

Code: Select all

set the tooltip of graphic "dgAlternatingRows" of group "Datagrid 1" to "hahaha"

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Tooltip question

Post by marksmithhfx » Sun Nov 06, 2011 4:25 am

Thanks Mark. I'll give that a try. I just wanted to have the tooltip say "Double Click to Edit". I'll post an example of the UI. I guess I could do the edits in the dg fields (datagrid window), but it just seemed easier to open the record in a separate window for editing.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Tooltip question

Post by marksmithhfx » Sun Nov 06, 2011 8:08 pm

Hi Mark, here is the basic layout of the UI and some of the functionality. You'll need to use the "create new" database option (it prompts you, or should) and add a record or two (using the + button). When you hover over the empty rows of the dg you get the tooltip "Double Click to Edit" which, while useful, is not really appropriate (the rows are empty). Better would be to have the tooltip appear when you hover over an actual record. That was my idea going into this; I think most of the UI is self evident, however it is not obvious (to me anyway) that double clicking on a record lets you edit it, so I thought a tooltip might be the trick.

Keep in mind this example is not polished
No attempt was made to make it look pretty
I'm basically trying to work out the UI elements and application functionality
Its not finished
Its not thoroughly debugged... apologies in advance if you end up in the debugger
I have not added townsends excellent looking "last resort" error handling routine... yet :D

Thanks for having a look.

-- Mark
Attachments
dbtest2.livecode.zip
(12.17 KiB) Downloaded 280 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Tooltip question

Post by mwieder » Sun Nov 06, 2011 8:41 pm

Looks nice and works well so far - no dropping into the debugger here. The tooltip shows up nicely and double-clicking did the trick.

I don't know where you're heading with this, but if you're going to build a standalone, keep in mind that changes to custom properties in a standalone aren't persistent - you'll have to store preferences in a separate text file or something. If it's going to be a stack rather than a standalone app then the openStack handler asks me if I want to create or open a database, but then the stack is still in edit mode, so you might want to "choose browse tool" afterwards.

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Tooltip question

Post by marksmithhfx » Sun Nov 06, 2011 10:06 pm

mwieder wrote: I don't know where you're heading with this, but if you're going to build a standalone, keep in mind that changes to custom properties in a standalone aren't persistent - you'll have to store preferences in a separate text file or something. If it's going to be a stack rather than a standalone app then the openStack handler asks me if I want to create or open a database, but then the stack is still in edit mode, so you might want to "choose browse tool" afterwards.
You're right. I forgot about the persistence issue in standalones. What's the best way to handle parameters? In this case I'll want to know the path to the db, and probably a couple of settings so I can reopen the display at the same place. I don't mind writing things out to disk and reading them back but where is the best place to put them? (and keeping in mind the different operating systems). Has anyone worked out a "generic" approach that works equally well on mac, windows and linux?

Also, thanks for the "browse tool" tip. I actually didn't know that.

-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Tooltip question

Post by mwieder » Tue Nov 08, 2011 10:44 pm

Has anyone worked out a "generic" approach that works equally well on mac, windows and linux?
specialFolderPath("preferences") works out to be safe storage for both OSX and Windows. Linux is a bit trickier since it's not as hardcore about where things go. I usually use specialFolderPath("home") and then create a folder or see if there's already a "Documents" folder and put it in there. If you can guarantee that the user has root permissions you can try putting something in /opt. But you can be pretty sure that the user has permission to store anything in the "home" folder hierarchy.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Tooltip question

Post by FourthWorld » Wed Nov 09, 2011 12:32 am

mwieder wrote:specialFolderPath("preferences") works out to be safe storage for both OSX and Windows.
"Preferences" on Windows? When I try it here it returns empty. What do you get there?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Tooltip question

Post by mwieder » Wed Nov 09, 2011 7:36 am

"Preferences" on Windows? When I try it here it returns empty. What do you get there?
...serves me right for thinking I know what I'm talking about and not testing things first. Now that I've gotten back to my Windows machine I see that specialFolderPath("Documents") works on Windows and is probably a safe place to start. I'd say the same about OSX, but I'm still on Snow Leopard and I've heard some strange things about supposedly safe folders on Lion.

Check the docs for what specialFolderPath() options work on different OSes.

<there... that sentence should be safe...>

Post Reply