Page 1 of 1
Set Controls as Non-Printable?
Posted: Thu Mar 22, 2018 1:05 pm
by cmhjon
Hi all,
Although I know I can write a script to hide buttons before printing, is there some way of assigning a non-printing property to a button (or other control)? I am working on an app that will include the printing of cards but don't want the buttons on said cards to appear on printed output.
Thank you,
Jon

Re: Set Controls as Non-Printable?
Posted: Thu Mar 22, 2018 2:28 pm
by dunbarx
Hi.
This is not possible; there is no such property.
But is it so onerous to set a custom property for all the controls that you do not want to print? Sort of the same thing you had in mind, no? You then loop through all controls and hide those with the "doNotPrint" property set.
Code: Select all
repeat with y = 1 to the number of controls
if the doNotPrint of control y = "true" then hide control y
print....
Craig Newman
Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 1:07 pm
by cmhjon
Hi Craig,
Thank you for the reply. Fortunately, there are only 4 controls that need hidden prior to printing which I have scripted. I wonder if perhaps a non-printing property is something worth consideration by LC to add in a future version of LC.
I haven't played with custom properties yet but will look into it.
Thank you so much,
Jon

Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 5:17 pm
by dunbarx
Hi.
The number of controls is not important. The repeat loop will take no time at all, and you can manage the custom property easily. Experiment a little. Make a handful of buttons, set a custom property for half of them. something like "changeColor". Then in a repeat loop in the card script:
Code: Select all
on mouseUp
repeat with y = 1 to the number of btns
if the changeColor of fid y then set the backColor of fld y to any item of "red,green,blue,orange"
end repeat
end mouseUp
Click on the card.
As for whether this ought to be a new feature in LC, you can certainly make your case. But because a handler that does this very thing is so simple, fast and compact, I doubt whether it will get traction. But feel free to start a thread on the "Features Request" page, or go directly to the QCC.
Craig
Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 5:24 pm
by FourthWorld
If practical to group the controls that you'd like hidden for printing then the brief code needed to hide them gets even shorter, just a single line to hide the group.
I like the idea of a built-in property to govern appearance in printed output, but given the wide range of ways people handle printing, and the ease of hiding and showing objects on the fly, you may find over time that it might be less useful than originally anticipated.
For example, if the trigger is when rendering to a print buffer, how would one implement a Print Preview which renders to the screen? We can handle these things flexibly with what he have now.
Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 5:41 pm
by cmhjon
Craig,
I have never played with custom properties, let alone know how to implement them. Please understand that I am an LC newbie who came from a HyperCard background (kind of dates it doesn't it? LOL).
From everything I have seen and read, I am blown away by LC's capabilities (compared to HyperCard).
Best regards,
Jon

Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 5:47 pm
by FourthWorld
The discussion of custom properties in the User Guide (beginning on p 154) provides good orientation and some useful examples.
You can access the User Guide through LC's Help menu.
You'll love custom properties. They open up so many flexible ways to bind data to objects.
Re: Set Controls as Non-Printable?
Posted: Fri Mar 23, 2018 9:38 pm
by dunbarx
I have never played with custom properties, let alone know how to implement them. Please understand that I am an LC newbie who came from a HyperCard background (kind of dates it doesn't it? LOL).
Almost every helper on this list came from HC. I thought I was the oldest. I am not.
The short experiment I mentioned will take you ten minutes, and then you will be an expert. I assume you know how to set a custom property, even if you never have.
1- "set the changeColor of btn 1 to "true". Yep, this is all you need, and no different than setting any other property. But like a variable, it is both created and loaded on the fly.
2- In the property inspector of a control, choose the "custom" pane, add the property ("add new element") and set its value. Again, pretty much like any other property.
Craig