Page 1 of 2
Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 7:45 pm
by macman56
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
Code: Select all
//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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:06 pm
by Simon
Hi macman56,
Welcome to the forum
This is a data grid
form correct?
In the DG group add:
Code: Select all
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:13 pm
by macman56
Thx but thats not what im what im looking for
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:28 pm
by Simon
Ooops sorry.. "no mouse"
Code: Select all
set the dgHilitedIndex of group "compound info" to 2
and then the rest of the "GetDataOfIndex "
Is that right?
Simon
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:39 pm
by macman56
thx but no its still not working
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:43 pm
by Simon
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:50 pm
by macman56
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 8:55 pm
by Simon
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:01 pm
by macman56
No its not highlighting any row
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:08 pm
by Simon
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:12 pm
by macman56
thecompound is a word and im trying to highlight the word in the data grid. The following is the coloumn im tryng to highlight in:
H2O1
C1O2
N1O2
C1H2O1
and im trying to highlight: H2O1
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:35 pm
by Simon
oops:
This is a data grid form correct?
Anyways, try the attached stack and tell me what it's not doing correctly for you.
Simon
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:39 pm
by macman56
I want to do the highlight button but in the stack script without using the the button
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:50 pm
by Simon
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
Re: Highlighting a line in a data grid
Posted: Tue Aug 27, 2013 9:54 pm
by macman56
On cCompoundInfo