put object in background ?

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

put object in background ?

Post by robm80 » Sat May 10, 2014 7:08 am

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.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: put object in background ?

Post by Simon » Sat May 10, 2014 7:47 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Sat May 10, 2014 11:33 am

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 ??

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Sat May 10, 2014 11:52 am

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 ??

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: put object in background ?

Post by FourthWorld » Sat May 10, 2014 2:51 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Sat May 10, 2014 9:18 pm

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.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: put object in background ?

Post by Simon » Sat May 10, 2014 11:45 pm

Hi Rob,
I'm not seeing it.
How is this different?

Simon
Attachments
Untitled 1.zip
LC 6.5
(595 Bytes) Downloaded 196 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: put object in background ?

Post by Klaus » Sun May 11, 2014 12:31 am

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

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Sun May 11, 2014 5:13 am

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: put object in background ?

Post by Klaus » Sun May 11, 2014 12:00 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: put object in background ?

Post by jacque » Sun May 11, 2014 7:12 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Mon May 12, 2014 6:52 am

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" ?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: put object in background ?

Post by Simon » Mon May 12, 2014 7:08 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Mon May 12, 2014 9:36 am

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.

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: put object in background ?

Post by robm80 » Mon May 12, 2014 10:41 am

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

Post Reply