Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Basic problem SetSelectionParagraphStyle, SetSelectionStyle
PostPosted: March 6th, 2009, 10:25 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
I get a fatal runtime error on Preview with the following code. It is pasted from Helpfile example. Resides as a function in a Script object. I named a std Text object to match (IntroText). It has 2 simple paragraphs of std text pasted in.
Code:
function testParaStyle2()
{
ParaNum = IntroText.ParagraphIndex(0);
ParaLength = IntroText.ParagraphLength(0);
IntroText.SetSelection(ParaNum,ParaLength);
var newStyle = new Object();
newStyle.justification = "Centre";
//newStyle.bullet.type = "Character";   //per Helpfile example, but throws an error. see next line
newStyle.bullet = "Character";
newStyle.bullet.character = "a";
//newStyle.bullet.font = "WingDings";   //per Helpfile example
newStyle.bullet.font = "Wingdings";
newStyle.bullet.colour = RGB(255,128,64);
IntroText.SetSelectionParagraphStyle(newStyle);
}



What am I missing here?

I verified there are no naming conflicts with objects or variables. Pub is a 1 page pub testing just for style methods.

The following also does not work using Helpfile example... with the standard setups to implement it (not Get Style, but did setup as 'new Object()' ). Info on this is under help for GetSelectionStyle().
Code:
newStyle2.fontaspect = 3 ; // or other numbers


Help needs help. :)

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject:
PostPosted: March 7th, 2009, 9:47 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
you have to pass the font information in as parameters. The help files are wrong/not clear
I had a list box for selecting the font. the selected font was saved in variable 'MyFontType' I was just changing the font.
The text I was changing was' myText'
Code:



myText.SetSelection(0,-1)//select the text



var newStyle = new Object()//create new text object
newStyle.fontname = MyFontType//set new font from list box selection

myText.SetSelectionStyle(newStyle)//apply the new style




I have extracted this from a big chunk of code where I saved the current font (incase the user changed their mind and cancelled the operation) so I hope I haven't missed anything. But the imp I have here works OK
Sandy

_________________
Whoever designed this, never actually used it!


Top
 Profile  
 
 Post subject:
PostPosted: March 8th, 2009, 10:16 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Thanks Sandy.

To be clear, I did not have a problem with changing Font type, Font size, and bolding, italic, etc when using the SetSelectionStyle( newthing ). Even if I put the fontname in quotes as a string.

It is this particular code cited above, that applies a Paragraph Style, where I have the Fatal Runtime Error. BTW, I have now tried running that by putting the fontname in a variable. No luck. It still dies.
Code:
//applied these statements within code posted above
var aNewFont1 = "MT Extra" ;
newStyle.bullet.font = aNewFont1 ;


I thought it might be because I did not set up bullets in that selected paragraph. So I went back and set bullets up in the editor, retried the script and still the same fatal error. The SetSelectionParagraphStyle( newSet1 ) does work for the justification, but fails on bullets. I did revert to a Windows System Restore point, and also did a Repair install of Opus. No solution there.

So more troubleshooting and testing to do.

Frustrating.

So many good things do work in Opus. I just expected something like this to be basic, straight forward.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject:
PostPosted: January 26th, 2010, 1:25 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
I wonder if this problem was 'picked-up' back when... and solved in Opus v7.

I'll be upgrading soon in any case.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
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 27 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