Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 11:35 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Advanced Scripting Question
PostPosted: January 22nd, 2007, 5:28 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I've been trying to write a script designed to clone a text box and text-input content, with no success.

What I've done as an experiment so far:

I've set up an Opus Pro pub with a page on which are a text input box (input1), saving text input to a variable and a text box (nametext) with the variable (<name>) inserted. When text is entered into the text input box, it appears in the text box as well.

I've set up a script to clone the text box and set each new clone's position at another location on the page, via right-click on the text input box. This works.

The script:
Quote:
myClone[ref] = nametext.CloneObject(160,90,true);
ref++


if (ref == 0)
{
myClone = new Array();
}


All needed variables for the scripts have been added.

Then I've set up a "save" button with the following script:
Quote:
save = ref + ",";

for (loop=0;loop<ref;loop++)
{
var pos = myClone[loop].GetPosition();
myClone[loop].SetSelectionText(0,-1)

var myName = myClone[loop].GetSelection()
var objdata = pos.x + "," + pos.y +"," + myName;
}

save += objdata;

if (loop < (ref - 1))
{
save += ",";
}
}


I've also set up a save to text file action for the variable "save"

Here's the first problem: when the pub is previewed, an error pop-up when the "save" button is clicked says :

Action (5, 0) : Object Not Found : The called object is not a valid object type (undefined? null?)

So, I'm stuck here.

As if this wasn't daunting enough, I realize that another whole layer of scripting would need to be added to any solution, to create a way to store each new text item in each newly cloned text box. Each box would have different text, like a user name, birthdate, etc. entered. If, I continue to use a single variable, every time any new text is entered in the "master" text input box, it would change the text of every cloned text box as well to this new input. (Instead of, for example, Charlie and Jane, and their separate birthdays, all the cloned text boxes would read the same: the last text input.) Ugh!

Lastly, I'll include my proposed script to reset the clones in their dropped position, upon returning to the page. Currently, for testing, this script is included in a "reset" button. Since I can't get past the error pop-up in the "save" button, I haven't even tested the reset script, but it likely also suffers from errors.

Reset script:


Quote:
textobj = OpenFile(SYSTEM_DOCUMENTS_DIR + "\\folderabc\\pos.txt");


ref = textobj.ReadField(false);

for (loop = 0; loop < ref; loop++)
{
x = textobj.ReadField(false);
y = textobj.ReadField(false);
z = textobj.ReadField(false)
myClone[loop] = nametext.CloneObject(x,y,true);
myClone[loop] = nametext.ReplaceSelection(z)
}




I'm afraid my scripting skills are far too limited, though I may be on the "right track." I would appreciate any help from Forum scripting experts who can give me some ideas about how to get this working. The goal is to be able to clone, drag and drop text boxes, each with different text entered, onto a drop zone, save and reset these in their correct positions with the correct text that had been entered for each text box.

My current way of achieving a more limited means of label-creating is running into difficulty: see Form posting

viewtopic.php?t=2344


Thanks for any assistance.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Script
PostPosted: March 18th, 2007, 5:27 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
This is a question for Chris. Email him at Chris@graphicsinaction.com I was having a scripting problem and would have never gotten it right without Chris' help.

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 18th, 2007, 6:16 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Denn

Issue resolved.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: March 20th, 2007, 12:11 am 
Offline

Joined: December 25th, 2004, 3:31 pm
Posts: 178
Can you post the solution please so others may benefit in future.


Joe


Top
 Profile  
 
 Post subject:
PostPosted: March 20th, 2007, 12:41 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Joseph

Unfortunately, the solution, which a colleague suggested, is woven into a much larger work and only understandable in the context of the entire work. I am unable to share the entire work.

However, if people are trying to achieve a specific result around this issue, I would encourage them to post on the Forum or e-mail me directly, detailing the result sought.

Then, hopefully, more expert Forum colleagues can suggest similar solutions, specific to the result needed. While I am far from expert on the issue, I also would try to respond to an e-mail request, if capable.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: March 20th, 2007, 1:01 pm 
Offline

Joined: December 25th, 2004, 3:31 pm
Posts: 178
Hi,

Maybe you can help me out with a problem. I currently want to pull a list of names from a database, once all have been displayed in a text box I want to place a tick box beside each, ideally both to be displayed at the same time. I assume the clone method is best for the tickbox as the number of names may change depending on what's in the database.

The reason for the tick box is that once I select each tickbox (put a tick in it) the names which are ticked will then be deleted from the database, or moved to a new table in the DB. I can pull the data from the DB but I'm unsure how to create the tickboxes this way with the clone and how to record if they are ticked or not.

Joe


Top
 Profile  
 
 Post subject:
PostPosted: March 20th, 2007, 1:24 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Joe

I wish I could help, but this one goes way beyond my skills. I afraid I can't get my brain around this.

The one thing I would mention regarding cloning, is that I haven't been able to get items that are framed in order to hold/move them together, to clone. So, if your original tick boxes and text items (as objects to be cloned) need to be held together by a frame, I don't think they will clone. I'm not sure why this happens, but framing seems to defeat cloning, in my experience.

In any event, if you post a sample of what you're trying to do, with some commenting, possibly other Forum colleagues with database and scripting expertise, or the DW support team, could help out.

Sorry I can't be of more assistance.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: March 20th, 2007, 1:57 pm 
Offline

Joined: December 25th, 2004, 3:31 pm
Posts: 178
I have set up a new post for this:
http://www.digitalgrapevine.info/viewtopic.php?p=10019#10019

And I have explained what I am trying to do further.


Thanks


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 56 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group