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!
Hey im trying to highlight or select an unknown line, the name is in a variable, in a data grid with out using the mouse to click on it so i can get the data from it and I have looked everywhere and I can't find the code and I need some help
//highlight the correct line
-- select the line thecompound in group "compound info"
-- find the lineIndex of thecompound in group "compound info"
-- put the lineIndex of me into compoundline
-- set the hilitedLine of group "compound info" to thecompound
-- get lineIndex of thecompound of group "compound info"
put thecompound into field "test 1"
get the lineIndex of item thecompound of group "compound info"
//takes the highlited lines of the field and puts it into a variable
-- put the dgHilitedLines of group "compound info" into compoundline
//takes the data of that line and splits it into the right columns
put the dgDataOfLine[compoundLine] of group "compound info" into compoundData
Last edited by macman56 on Tue Aug 27, 2013 8:39 pm, edited 3 times in total.
on mouseDoubleUp
put the dgHilitedIndex of me into theIndex
put GetDataOfIndex (theIndex,first_name) into fld "firstname"
put GetDataOfIndex (theIndex,last_name) into fld "lastname"
end mouseDoubleUp
first_name/last_name you will have to change there to match your keys. Oh, and where you want to put them.
And If I misunderstood your question entirely... Drats!
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
I guess then if you want help you could add a bit more than "thx but no its still not working".
Which part isn't working?
What isn't it doing for you?
Could you explain in more detail what you are after?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
im trying to take my global variable that contains the row im looking for, thecompound, and find and highlight it in my data grind, group "compound info", without using my mouse
Interesting, because that's what it's doing here:
set the dgHilitedIndex of group "compound info" to thecompound
Doesn't highlight thecompound row for you?
Does it highlight any row for you?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Is thecompound within the range of keys you have? If it's higher than the number of keys nothing will be highlighted.
Try setting the thecompound to 1, you must have at least 1 key in the DG or did your array start on a different number?
Hey maybe you didn't use numeric's in your array? Can you post part of the array you used to fill the DG?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Ah, so the button did work for you!
If you look into the script of the button it notes that the line did not have to be in a button. Put the anywhere that's available to the DG.
So the problem you are facing is the script works it's just not working from where you are running it? Which then asks how do you trigger it or exactly how do you want it to be triggered? e.g openCard, after the DG is loaded, when someone types something into a field???
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!