Page 1 of 2

put object in background ?

Posted: Sat May 10, 2014 7:08 am
by robm80
I want to have a scrolled field list on each card.
Do I have to copy it, or is there a way to put it in the background,
so it has not to be copied and it is also visible on each card.

Re: put object in background ?

Posted: Sat May 10, 2014 7:47 am
by Simon
Hi Rob,
You can group just the list field and set the group to behave like background.
Now you know the same content will show up on each card right?

Simon

Re: put object in background ?

Posted: Sat May 10, 2014 11:33 am
by robm80
I did so, but yes, the field is on each card, but content NO.
So I try something else.
And BTW, when I select all to group it, nothing happens until I remove the scrollfield.
And when I create a new scrollfield there is the same problem,
There is no selectedtext anymore , so the field does not what it used to do.

another question:
In the stackscript I wrote:
on opencard
put the number of this card && "of" && the number of cards of this stack-1 into field "pagnum"
end opencard


So when I create a new card, this script makes it impossible.
I want to keep the script before a newcard is made with:
set the clipboardData["text"] to script of this stack

BUT HOW TO EMPTY THE STACKSCRIPT ??

Re: put object in background ?

Posted: Sat May 10, 2014 11:52 am
by robm80
I did so, but yes, the field is on each card, but content NO.
So I try something else.
And BTW, when I select all to group it, nothing happens until I remove the scrollfield.
And when I create a new scrollfield there is the same problem,
There is no selectedtext anymore , so the field does not what it used to do.
forget this, my fault, wrong field

another question:
In the stackscript I wrote:
on opencard
put the number of this card && "of" && the number of cards of this stack-1 into field "pagnum"
end opencard

So when I create a new card, this script makes it impossible.
I want to empty and keep the script before a newcard is made with:
set the clipboardData["text"] to script of this stack

BUT HOW TO EMPTY THE STACKSCRIPT ??

Re: put object in background ?

Posted: Sat May 10, 2014 2:51 pm
by FourthWorld
robm80 wrote:BUT HOW TO EMPTY THE STACKSCRIPT ??

Code: Select all

set the script of stack "StackName" to empty
But it's extremely rare that you'd ever actually need to have self-modifying code at runtime. There's almost always a better way to solve whatever problem you face.

Going back to the original goal of having a field present on each card, in addition to putting it into a shared group you can also turn on the sharedText property for the field, and then its text contents will be shared across every card its present on.
robm80 wrote: question:
In the stackscript I wrote:
on opencard
put the number of this card && "of" && the number of cards of this stack-1 into field "pagnum"
end opencard


So when I create a new card, this script makes it impossible.
What's happening there that you don't want?
I want to keep the script before a newcard is made with:
set the clipboardData["text"] to script of this stack
The clipboard belongs to the user. They have have data on it from other applications unrelated to yours, so it should only be overwritten when the user explicitly requests it with Edit->Copy.

If you just need a container use a variable.

But in this case, we're looking at self-modifying code, which is usually much more complex than is needed.

Forgive me if I missed something obvious in the earlier posts, but if you can describe what you want to achieve here I'll be we can come up with a relatively simple solution quickly for you.

Re: put object in background ?

Posted: Sat May 10, 2014 9:18 pm
by robm80
my menuscript:
on menuPick pItemName
switch pItemName
case "noscript"
set the script of stack "PK" to empty ---> does not work
put script of this stack into vStack ---> how to declare vStack as an varaible
break
case "yesscript"
put vstack into script of me ---> for the time the script is not empty, I can't see if it works
break
end switch
end menuPick

again" what I want is to create a new card, but that is stopped by the stackscript:
on opencard
put the number of this card && "of" && the number of cards of this stack-1 into field "pagnum"
end opencard

so I made this menu to empty the script, while creating new cards.

Re: put object in background ?

Posted: Sat May 10, 2014 11:45 pm
by Simon
Hi Rob,
I'm not seeing it.
How is this different?

Simon

Re: put object in background ?

Posted: Sun May 11, 2014 12:31 am
by Klaus
Hi Rob,

why not just put this into the stackscript and leave tha card scripts empty?

Code: Select all

on opencard
  if there is a field "pagnum" then
      put the number of this card && "of" && the number of cards of this stack-1 into field "pagnum"
  end if
end opencard
:D


Best

Klaus

Re: put object in background ?

Posted: Sun May 11, 2014 5:13 am
by robm80
Hi Klaus,
thanks very much; this is the trick:
if there is a field "pagnum" then
but the real thing is : where will I find this syntax?

I looked in the dictionary and the tutorials, but something simple as this, could not be found.
Anyway, my testcase is ready and runs, but for at least 40% with all the help I got.

thanks again
Rob

Re: put object in background ?

Posted: Sun May 11, 2014 12:00 pm
by Klaus
Dag Rob,
robm80 wrote:Hi Klaus,
thanks very much; this is the trick:
if there is a field "pagnum" then
but the real thing is : where will I find this syntax?
this is not a question of syntax in the first place, it is about LOGICS!

How would you solve this logical problem WITOUT a computer and Livecode?
If you can explain the problem to yourself in your own words, you can translate it to Livecode almost 1:1!


Best

Klaus

Re: put object in background ?

Posted: Sun May 11, 2014 7:12 pm
by jacque
robm80 wrote: but the real thing is : where will I find this syntax?
Klaus is right, you do need a bit of logic to find it. Usually thinking of how you'd ask the question in plain English will get you close to the term you're looking for. Then look at the "see also" entries to find out what else is available. For example, you probably got an error about "no such object" or "object can't be found," so I might realize that I need to check if an object exists before trying to work with it. So I would look up "exist" -- and there it is. In the "see also" section it lists "there is a" also. In this case, either term would work.

Re: put object in background ?

Posted: Mon May 12, 2014 6:52 am
by robm80
I agree with "logics" and I found in the lessons a "see also" with 95 articles, but I did not get any answer for these questions:
In the pulldown menu I wrote:
on menuPick pItemName
switch pItemName
case"naam"
put empty into fld "pagnam"
ask "welke naam"
set text of field "pagnam" of cd "PK"to it
break
case "kaart"
get text of field "pagnam" of cd "PK"
if fld "inhoud" is not empty
then put cr&it after fld "inhoud"
else
put it&cr after fld "inhoud"
end if
sort lines of field "inhoud" of cd "PK"
create card it[/color]

set the backgroundcolor of this card to white ---> error: compilation error at line 17 (Expression: unquoted literal), char 43; char 43 is the i in "white"
set text of field "pagnam" of this card to text of field "pagnam" of cd "PK"
sort lines of field "inhoud" of this card
break
case "verwijder"
get text of field "pagnam" of cd "PK"
delete cd it

put lineoffset(it,field "inhoud" of cd PK) into tLine ---> error: compilation error at line 24 (Expression: unquoted literal), char 44; char 44 is the i in "into"
if tLine <> 0 then
delete line tLine of field "inhoud" of cd PK
break
end if
end switch
end menuPick


I don't understand these errors even not with logic thinking, nor tells "see also" anything about these errors.
Or do you have another "see also" ?

Re: put object in background ?

Posted: Mon May 12, 2014 7:08 am
by Simon
The "unquoted literal" is the clue
Just like in the dictionary
set the backgroundcolor of this card to "white"
and then this
put lineoffset(it,field "inhoud" of cd "PK") into tLine

You have it right (edit: almost) everywhere else :)

Simon

Re: put object in background ?

Posted: Mon May 12, 2014 9:36 am
by robm80
and then this
put lineoffset(it,field "inhoud" of cd "PK") into tLine

You have it right (edit: almost) everywhere else :)
Sorry, don't understand.
After I had quoted "white", there was no error anymore.

Re: put object in background ?

Posted: Mon May 12, 2014 10:41 am
by robm80
put lineoffset(it,field "inhoud" of cd PK) into tLine ---> error: compilation error at line 24 (Expression: unquoted literal), char 44;
Please tell me what's wrong with this (Klaus) line; it makes the pulldownmenu strikes