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
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Sun Jan 18, 2015 1:26 am
In the code below is there a reason my my "...set visible of [button] to false!" code isn't functioning?
I have had a tinker and cannot get the button to disappear for when the printInvoiceis called,
Code: Select all
on printInvoice
set the visible of button "btnPrint" to "false"
put specialFolderPath("documents") & "/Invoice013.pdf" into tPDFPath
-- Handle the default text of the myCompany field
if the text of field "myCompany" is "Your company" then
set the visible of field "myCompany" to false
else
set the visible of field "myCompany" to true
end if
open printing to pdf tPDFPath
if the result is "Cancel" then
exit printInvoice
else
--print card "invoice" of this stack from 0,0 to 575,600 into 0,0,575,800
print card "invoice" of this stack into 0,0,575,800
end if
close printing
set the visible of button "btnPrint" to "true"
end printInvoice
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Sun Jan 18, 2015 2:19 am
Is it possible that button "btnPrint" is on a card other than the active card? If so adding "of cd CardNumber" could be the answer. I see nothing wrong with the code posted here , so it has to be something happening out of the scope of what you posted.
-
Tukcedo
- Posts: 65
- Joined: Fri Jun 27, 2014 9:43 pm
Post
by Tukcedo » Sun Jan 18, 2015 8:58 am
Not sure if this matters, but true and false are normally used without the quotes ...
Michel J.L. van der Kleij
Coding to help stray animals in the Philippines
Albert Foundation - http://albert.tukcedo.nl
Aklan Animal Rescue & Rehabilitation Center - http://aarrc.tukcedo.nl
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Mon Jan 19, 2015 2:35 pm
I moved all of the code from the stack script to the card script, the button was still visible when printing the pdf.
I then did a separate test by starting a new stack, adding a button and attaching the following script to the button:
Code: Select all
on mouseUp
set the visible of button "Button" to false
end mouseUp
When I clicked the button in Run mode, the button didn't disappear. However, I did notice that the visible flag in the button properties is being unset. I wonder if there is some sort of bug with this.
Or maybe I'm just doing it wrong.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Jan 19, 2015 2:46 pm
I never had any problem setting the visibility of any object in LC in the last 15 years!
So I presume, there is something else going on, but have no idea what!?
Is this on Mac or Windows?
-
magice
- Posts: 457
- Joined: Wed Mar 18, 2009 12:57 am
Post
by magice » Mon Jan 19, 2015 2:48 pm
SheyMouse wrote:I moved all of the code from the stack script to the card script, the button was still visible when printing the pdf.
I then did a separate test by starting a new stack, adding a button and attaching the following script to the button:
Code: Select all
on mouseUp
set the visible of button "Button" to false
end mouseUp
When I clicked the button in Run mode, the button didn't disappear. However, I did notice that the visible flag in the button properties is being unset. I wonder if there is some sort of bug with this.
Or maybe I'm just doing it wrong.
Does it disappear when you print to the printer? I am curious if this may be a bug when printing to pdf. One other question though. Do you have "Show invisible objects" checked?
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Mon Jan 19, 2015 3:00 pm
@magice - I wouldn't know how to print to an actual printer.
If someone else more experienced reads this and wants to take a crack at it, that would be very useful.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Jan 19, 2015 3:03 pm
The scripts posted here look correct!?
Please also try this:
...
hide btn "btnPrint"
...
# Resp.
show btn "btnPrint"
...
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Mon Jan 19, 2015 3:11 pm
@Klaus - The results were the same as encountered earlier. The "Visible" box is being unchecked, but the button does not disappear.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Jan 19, 2015 3:15 pm
That's just too funky!?
Can you send me the (stripped down) stack, so I can take a look?
Will be much more effective that guessing around here for a couple of hours
Send it to: klaus AT major-k.de
Is the stack in LC 7 format?
Does this happen on a Mac or WIndwos?
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Mon Jan 19, 2015 3:38 pm
@Klaus - email sent.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Jan 19, 2015 3:51 pm
Hmmmm, molto mysterioso, worked as exspected here on my Mac!
Out of ideas currently...

-
SparkOut
- Posts: 2943
- Joined: Sun Sep 23, 2007 4:58 pm
Post
by SparkOut » Mon Jan 19, 2015 4:03 pm
Have you got "Show invisible objects" checked in the View menu maybe?
-
SheyMouse
- Posts: 9
- Joined: Sat Jan 17, 2015 1:06 am
Post
by SheyMouse » Mon Jan 19, 2015 5:01 pm
All,
Thank you for your help and replies. Based on a chat with Klaus, and the other replies, I decided to take a look at my installation.
It appears as though an old installation, possibly 6.x or 7.0 (RC2) was having an influence on my install. Removing all older versions of LiveCode resulted in the button disappearing as expected.
Thanks for your support.