DataGrid Form row hilite

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
chriswood
Posts: 23
Joined: Mon Feb 23, 2009 2:27 am

DataGrid Form row hilite

Post by chriswood » Tue Dec 08, 2009 6:46 am

I'm still getting a feel for DataGrids but have noticed that it is possible in a DataGrid form to have say row 3 hilited but an editable field in row 2 focused (see attached screenshot). For the project I am working on the row containing the focused object should always be hilited.

So I'm thinking that the best way to do this is to get the row number that the focused or clicked object is in and then hilite that row. Is this possible or is there an easier way?

Best Regards

Chris
Attachments
DataGrid hilited Rows.png
DataGrid hilited Rows.png (29.82 KiB) Viewed 3058 times

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: DataGrid Form row hilite

Post by trevordevore » Fri Dec 11, 2009 3:36 pm

Chris,

You will have to script the hilites yourself if you want to change the hilite as focus moves from a control in one row to a control in another row. In the Data Grid script you could do something like this (completely untested code):

Code: Select all

on openField
    HiliteRowOfFocusedControl
end openField


on focusIn
    HiliteRowOfFocusedControl
end focusIn


command HiliteRowOfFocusedControl
    ## Get row control for field being opened
    put the dgDataControl of the target into theControl
    
    if theControl is not empty then
        set the dgHilitedIndexes of me to the dgIndex of theControl
    end if
end HiliteRowOfFocusedControl
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

chriswood
Posts: 23
Joined: Mon Feb 23, 2009 2:27 am

Re: DataGrid Form row hilite

Post by chriswood » Mon Dec 14, 2009 7:13 am

Thank you Trevor that works a treat.

Best Regards

Chris

Post Reply