Source language: Translate to:

Help! Problem with SetObjectFont ! Bug ?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Help! Problem with SetObjectFont ! Bug ?

Postby impulsmedia » Tue Jul 18, 2006 2:44 pm

Hi there!

I´m working on a mulitlanguage pub and therefore I want to use the SetObjectFont Command to change the font attributes of a textobject.
Doing this I found a strange bug:
If I use a textobjext with text directly written in the object everything works fine. If I use a textobject with a var as placeholder for the text and change i.e the stlye from Normal to Bold I get a @ in front of the text and this @ will not disappear until I restart the pub. I have written a small test pub, so everybody can check out what I mean.

The sourcecode of the pub is:

NBW Publication Source File
(C)1993-2006 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,51
ScreenColors=16777216
ScreenWidth=320
ScreenHeight=200
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
Variables=[style]¶[vartext]¶
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
CustomFontName=MS Sans Serif
CustomFontSize=8
CustomFontStyle=1
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
EffectSpeed=0
PgEnterAction=SetVar "[vartext]" "This text is the content of the variable vartext"
ObjectType=8
Name=Text1
X=8
Y=20
W=304
H=88
Anchor=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 This text is written directly into the text object.\par\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \par\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 [vartext]}}}
HMargin=0
VMargin=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
TabOrder=2
ObjectType=3
Name=bold
X=228
Y=124
W=84
H=28
Anchor=0
Text=bold
Align=2
ImageStyle=0
ObjAction=SetVar "[style]" "Bold"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=3
Name=normal
X=228
Y=160
W=84
H=28
Anchor=0
Text=normal
Align=2
ImageStyle=0
ObjAction=SetVar "[style]" "Normal"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=3
Name=apply
X=8
Y=156
W=88
H=28
Anchor=0
Text=apply
Align=2
ImageStyle=0
ObjAction=SetObjectFont "Text1" "Black" "Arial" "9" "[style]" "DEFAULT_CHARSET"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5

Any idea what problem i have. Thanks for any hint !

kind regards,
Walter[/b]
thanks in advance and greetings from Germany,
Walter
impulsmedia
 
Posts: 38
Joined: Wed Mar 22, 2006 9:01 am
Location: GERMANY

Postby Neosoft Support » Tue Jul 18, 2006 4:34 pm

Hello Walter,

Thank you for supplying a sample publication.

You're right, there does appear to be a problem when using the SetObjectFont action with Simple Text objects that contain variables. Unfortunately, we just released an update an update a couple of days ago, so a program fix will have to wait a little while. In the mean time, here are a couple of work around options:

1. After calling SetObjectFont, use the SetObjectCaption action to restore the Text object's original text. For example:

Code: Select all
SetObjectFont "Text1" "Black" "Arial" "9" "[style]" "DEFAULT_CHARSET"
SetObjectCaption "Text1" "This text is written directly into the text object.[#13][#13][vartext]"


2. Use a different type of object such as a Push Button or Article to store the text. Both of these objects appear to work correctly with SetObjectFont.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Thank You

Postby impulsmedia » Wed Jul 19, 2006 12:51 am

Hi !
Thanks for the workaround. The SetCaption idea is quite nice, but doesn´t work stable as far as I tested it now. I´ll change my pub to linked artikel, I think.

kind regards
Walter
thanks in advance and greetings from Germany,
Walter
impulsmedia
 
Posts: 38
Joined: Wed Mar 22, 2006 9:01 am
Location: GERMANY


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests