Page 1 of 2
Select in Data Grid
Posted: Sun Oct 04, 2020 8:56 am
by SEAL29
How to do that by selecting a row in the data grid then jump to that card using a button.
So i have one list with different titles and every title lead on different card, i select one title and jump that card with pressing button?
I put it wrong but I can't describe it any other way.
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 9:39 am
by richmond62
How to do that by selecting a row in the data grid then jump to that card using a button.
1. select a row in
a datagrid.
2. "jump to
that card".
part 1 is easy-peasy, lemon-squeezy:
Code: Select all
on mouseDown
put the clickline into fld "fLineClicked"
end mouseDown
part 2 makes me wonder what you mean by "that card".
a) If you mean that you want to use a
datagrid as a
navigation menu, I think you are over-doing things a bit:
personally I'd just "go for" a
scrolling list field . . .
BECAUSE when I click on my DG with that script above the data the line contains does NOT end up in the output.
-
-
This screws up in a Datagrid:
Code: Select all
on mouseDown
put the selectedText of me into fld "fLineClickedx"
end mouseDown
BUT works perfectly in a listField.
-
-
Code: Select all
on mouseDown
put the selectedText of me into XXX
go to card XXX
end mouseDown
-
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 9:41 am
by richmond62
Here's my stack with the listField.
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 12:05 pm
by SEAL29
This is it, thank you.
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 12:23 pm
by klamp
Thank you for the senior members of the livecode. It is very helpful for the sample stack that you provide.

Re: Select in Data Grid
Posted: Sun Oct 04, 2020 1:06 pm
by SEAL29
How can i add in Scrolling List Field each new text on a new line with button? There is a field in which I type the text and copy it in the Scrolling List Field with buton.
I now use this code, but it always copies only one line and deletes the previous word.
Code: Select all
on mouseUp pMouseButton
set the text of field "scrollingList" to the text of field "titleField"
record the text in field "scrollingList"
end mouseUp
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 3:51 pm
by richmond62
Well: you have to do a bit more than that:
1. You have to add a new line of text in your listField.
2. You have to add a new card to the stack with the same name as the line of text you have put in your listField.
Button:
ADD NEW ITEM:
Code: Select all
on mouseUp
ask "Text for new item: "
put it into KKK
put 1 into KOUNT
repeat until line KOUNT of field "SLF" is empty
add 1 to KOUNT
end repeat
put KKK into line KOUNT of field "SLF"
create card KKK
go first card
end mouseUp
The ONLY PROBLEM is I cannot work out how to inject a script into a new card to set its title to its name.
-
-
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 4:05 pm
by richmond62
Why am I so good at saying I cannot work something out just before I do?
Code: Select all
on mouseUp
ask "Text for new item: "
put it into KKK
put 1 into KOUNT
repeat until line KOUNT of field "SLF" is empty
add 1 to KOUNT
end repeat
put KKK into line KOUNT of field "SLF"
create card KKK
set the script of card KKK to ((fld "s1" of card "HOME") && KKK & quote & cr & (fld "s2" of card "HOME"))
go first card
end mouseUp
-
-
-
"OFF" to have
Etwas dunkles Bier.

Re: Select in Data Grid
Posted: Sun Oct 04, 2020 4:08 pm
by richmond62
BUT . . . just before I go, I would like to state that the ONLY way I am ever likely to use a dataGrid is
if someone cocks a gun at my head . . .
. . . I am sure they are "all very clever and useful in their way", but I'd far rather stick to
listFields and tableFields.
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 4:49 pm
by dunbarx
What Richmond really meant, even being held hostage by his own hand, is that new users often use dataGrids too soon.
DataGrids are compact, elegant and powerful tools, written by one of our most resourceful members. But they have their own API and are complex. They are attractive to those new users I mentioned because they seem to have everything one could ask for in a single package.
They do.
But they have a learning curve quite apart from LiveCode's own, and are often not nearly necessary to implement the functionality required. I am in no way trying to steer anyone away from learning about them. But I am advising that the more basic controls be examined first, since they are far simpler to use, and oftentimes do just what Richmond said, work just fine.
Craig
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 5:05 pm
by SEAL29
The 3rd Navi - Gator is work perfectly great thanks for this.
Re: Select in Data Grid
Posted: Sun Oct 04, 2020 6:22 pm
by richmond62
-
Kein dunkles Bier, aber gut genug für mich.
Thinking about things, I think I'd modify the contents of field "s1" to this:
Code: Select all
on openCard
set the title of this stack to "
So that 'card fishface' is just called 'fishface' instead.

Re: Select in Data Grid
Posted: Fri Oct 09, 2020 8:48 am
by richmond62
From "somewhere else":
could import the title from an existing field into the scrolling-list-field by jumping to that current card. So I'm not typing in an address, I'm importing an existing one.
The problem that I can see about this is that the code bunging the title of a field on a car into a line in a scrolling
list field (SLF) would have to be in that card's cardScript, so, everytime one went to that card it would pop the name of the field
on that card into a line in the SLF.
-
Re: Select in Data Grid
Posted: Sat Oct 10, 2020 8:38 am
by richmond62
Actually that is pretty silly . . .
1. The listing in the inital SLF is of card names: if those are changed to the titles of textFields residing on those cards
the navigational capacity will be lost . . .
2. So: if you really think "that is the way to go" you might want to put the name of the textField into the second item of a more complex scrolling field.
-

- DD.jpeg (6.85 KiB) Viewed 6715 times
-
https://youtu.be/pr3zpqp3ypY
-
Well; there's one way to go.
HOWEVER . . . a
tableField will NOT accept mouseDown signals in the same way as a SLF.
-
Re: Select in Data Grid
Posted: Sat Oct 10, 2020 9:05 am
by richmond62
-
I think you are going to have a problem.
For example on my card "fishpie" I have a field called "How to cook Rotis", and that is all very jazzy, BUT if
our code is going to be in the cardScript to put the name of that field into item 2 [{Delimited lines] of the
card's line in the SLF on the first card of the stack HOW is it going to refer to the field without ALREADY knowing its name?