Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Variables - Print to screen Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
RWCS
Senior Member
Senior Member
Avatar

Joined: October 28 2002
Location: United States
Online Status: Offline
Posts: 102
Posted: June 01 2004 at 20:35 | IP Logged Quote RWCS

Is there a way to print a variable to the PH screen?

Bob

__________________
RWCS LLC
Back to Top View RWCS's Profile Search for other posts by RWCS Visit RWCS's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 01 2004 at 23:02 | IP Logged Quote dhoward

Robert,

Yes...it's not real easy, but it can be done.  Basically, you can do all kinds of things using the ph_ccmodify function.  Rather than try to detail everything that can be done (that would probably take an entire book), I'll show you a couple of pieces of code that you can experiment with.

The first code will create a new static text object on a Control Center tab:

ph_ccmodify(3,'create text(name=gv_inside_temp pointer="arrow!" band=detail font.charset="0" font.face="Arial" font.family="2" font.height="-10" font.pitch="2" font.weight="400" background.mode="2" background.color="12632256" color="0" alignment="2" border="2" x="2084" y="1936" height="96" width="1000" text="Inside Temperature: ' + ph_getglobal_s("INSIDE_TEMP") + ' degrees.")')

You can see that we are using only the ph_ccmodify function.  The first parameter is the tab number you wish to create a control on.  In my example, Im using tab number 3.  The second parameter is the actual syntax used to create an object.  You can experiment around with the values used in this syntax as most are pretty much self explanatory.  You should only ever create an object with the same name once.  In my example, Im going to use the global variable "INSIDE_TEMP" so Ive named the new text object "gv_inside_temp".  Once you've created a new object, you can update its properties.  Again you do this with ph_ccmodify, but with a slightly different syntax.  In the example below, Im going to update the text with the most current value of the "INSIDE_TEMP" global variable.

ph_ccmodify(3,'gv_inside_temp.text="Inside Temperature: ' + ph_getglobal_s("INSIDE_TEMP") + ' degrees."')

You can see in the above example, Im still using tab 3.  I next reference the name that I gave the text object when I created it, "gv_inside_temp".  Then using dot notation, I access it's properties, in this case the "text" property.

You would typically use the first function only once when PowerHome is started, such as in the "STARTUP" macro.  You could then create a macro that you use to update your global variable and include the second function.  As long as you only update the global variable using the macro, the value of the GV will be reflected upon your Control Center tab.

Let me know if you need clarifications or have further questions,

HTH,

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
RWCS
Senior Member
Senior Member
Avatar

Joined: October 28 2002
Location: United States
Online Status: Offline
Posts: 102
Posted: June 02 2004 at 08:08 | IP Logged Quote RWCS

Dave

My manual doesn't contain info on ph_ccmodify (At least Adopie can't find it). It is no surprise that the formula doesn't work (evaluates to !). What version of SW do I need (I'm running 1.02)?

Formula attempted:

ph_ccmodify(1,'create text(name=gv_count pointer="arrow!" band=detail font.charset="0" font.face="Arial" font.family="2" font.height="-10" font.pitch="2" font.weight="400" background.mode="2" background.color="12632256" color="0" alignment="2" border="2" x="10" y="10" height="96" width="1000" text="Test Count: ' + ph_getglobal_s("COUNT")")')


Bob

__________________
RWCS LLC
Back to Top View RWCS's Profile Search for other posts by RWCS Visit RWCS's Homepage
 
RWCS
Senior Member
Senior Member
Avatar

Joined: October 28 2002
Location: United States
Online Status: Offline
Posts: 102
Posted: June 02 2004 at 10:05 | IP Logged Quote RWCS

Dave

I'm up to 1.03.4 now (at great personal expense), and this formula is still not working.

Bob

__________________
RWCS LLC
Back to Top View RWCS's Profile Search for other posts by RWCS Visit RWCS's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 02 2004 at 10:54 | IP Logged Quote dhoward

Robert,

I wasnt sure what "great personal expense" meant until I saw that you purchased PowerHome last night.  Upgrades are free and my records indicate you have already previously licensed PowerHome.  Email me and we'll get it worked out.

Looking at your formula, you are missing a plus sign and a single quote towards the end of your formula.  One other thing I forgot to mention is to be sure that the name of your object does not contain any spaces (yours is ok).  Below is the corrected version of your formula:

ph_ccmodify(1,'create text(name=gv_count pointer="arrow!" band=detail font.charset="0" font.face="Arial" font.family="2" font.height="-10" font.pitch="2" font.weight="400" background.mode="2" background.color="12632256" color="0" alignment="2" border="2" x="10" y="10" height="96" width="1000" text="Test Count: ' + ph_getglobal_s("COUNT") + '")')

Let me know how it goes and be sure and email me so we can clear up your double purchase.

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
RWCS
Senior Member
Senior Member
Avatar

Joined: October 28 2002
Location: United States
Online Status: Offline
Posts: 102
Posted: June 02 2004 at 14:28 | IP Logged Quote RWCS

Dave

Not that I understand when to use a " and when to use a ', but I managed to muddle my way through hacking you example, until it worked. Thanks for your help.

Bob

__________________
RWCS LLC
Back to Top View RWCS's Profile Search for other posts by RWCS Visit RWCS's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum