Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 5th, 2024, 12:14 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Link the display numbers in a calculator to a page variable
PostPosted: December 31st, 2012, 6:21 pm 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
I have downloaded the free calculator from DW website and I have been trying to link the display number (a text object called DisplayString in the original calculator) to a page variable called price_right , by ticking the text input option “Allow user...” , so when I click a button if price_right is, let's say 55, it will add 1 to my score.

I have done this before with other text input objects, but with this from the calculator it doesn't work. Also by ticking the text input option, the format of the numbers displayed changes with shadow or flare.

I have attached an example in case someone have a solution without scripting.


You do not have the required permissions to view the files attached to this post.


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Link the display numbers in a calculator to a page vari
PostPosted: January 3rd, 2013, 12:52 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
It won't work because the text box doesn't contain a variable. It uses the replace string functionality to update the display and therefore making the text box editable will have no effect as Opus doesn't know that the value has changed.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Link the display numbers in a calculator to a page vari
PostPosted: January 3rd, 2013, 7:16 pm 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
Thanks Mack,

So, If there any simple scrip for an action button to recognise the number that show the calculator?

Something like

if
DisplayString= 55
then
add 1 to right_ factory (This would be a page variable)

the idea is to add points to a page variable if the calculator shows the right number.


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Link the display numbers in a calculator to a page vari
PostPosted: January 4th, 2013, 10:28 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Isma,

It handles the update of the display in a slightly odd way depending on whether it's performing an operation or entering a value but if you swap the UpdateDisplay function in the Main Script with this version - it will get the last value on screen and store it in your price_right variable:

function UpdateDisplay()
{
var style=new Object;
style.justification="right"

DisplayString.SetSelectionParagraphStyle(style)

DisplayString.SetSelection(0,-1)
if(bStringDisplay){
DisplayString.ReplaceSelection(DISPLAY_STRING)
} else {
DisplayString.ReplaceSelection(DISPLAY_NUMBER)
}

DisplayString.SetSelection(0,-1)
price_right = DisplayString.GetSelectionText()
DisplayString.SetSelection(-1)


}

I've just hacked the three lines in red to the bottom of the function that simply selects the textbox contents and copies the text to the price_variable and then deselects the text.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Isma


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group