Hot Topic (More than 10 Replies) Printstring errors (Read 3403 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Printstring errors
Apr 12th, 2010 at 10:47pm
Print Post Print Post  
After upgrading to 2.5.1, Printstring() command is printing all text in one narrow column on left of page. Lines are wrapping after each word.

In my 2.0 prog. guide, I see a new argument in the Printstring() command called 'alignment' but I see not documentation for this in the book, or in the 2.5.1 errata. Am I overlooking it?

Thanks for any help or insight.

Steve
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #1 - Apr 12th, 2010 at 11:18pm
Print Post Print Post  
I found some documentation in the sbasic program module, which I posted below, but it seems my issue is because I am printing from a text EDITOR field. Printing from a text BOX gives good results.

alignment is an optional argument indicating how the text should be aligned. If no alignment is specified, text will be aligned left.
Valid alignment values as defined in the sbasic_include.sbas file are:
PRINTSTRING_ALIGN_LEFT
PRINTSTRING_ALIGN_RIGHT
PRINTSTRING_ALIGN_CENTER

My program is simple (message is a multi-line text box):
newpage(850,1100)
printstring(message, 22,100,600,"verdana",12,0)
finishpage()
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #2 - Apr 12th, 2010 at 11:56pm
Print Post Print Post  
Looks like the problem is when printing an email address. The @ sign is causing problem. Is there a workaround?
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Printstring errors
Reply #3 - Apr 13th, 2010 at 2:18am
Print Post Print Post  
Hi Steve,

I ran into some trouble last year with email addresses in a PrintString command. There are actually two issues.

1. First issue is that you need to double up the @ symbol, or else all text that comes after it (in the same field) will not print with PrintString. The fix for that is easy and works very well, as shown here.
Code
Select All
// Must double "@". Otherwise it, and anything after it, will not print from that field.
PrintString(@Replace(Email, "@", "@@"), 70, 300, 0, vFont1, vSizeReg, 0) 



2. Second issue is that word-wrap refuses to function properly within a PrintString command if the field contains an @ symbol (even if you double that symbol). I had to resort to changing the @ symbol with something that 'looked' close to it. I used "®". It's not perfect, but that was the best I could do. I did not change it in the field. I just replaced it within the PrintString command, similar to the code above, using @Replace(Email, "@", "®").
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #4 - Apr 13th, 2010 at 8:49pm
Print Post Print Post  
Thanks Carl. Hopefully this will be fixed, or at least documented,  in a future version.

Sincerely,
Steve
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Printstring errors
Reply #5 - Apr 13th, 2010 at 8:56pm
Print Post Print Post  
Steve_in_Texas wrote on Apr 13th, 2010 at 8:49pm:
Thanks Carl. Hopefully this will be fixed, or at least documented,  in a future version.

It's written up here, Steve. We're looking into it.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #6 - Apr 13th, 2010 at 9:07pm
Print Post Print Post  
Many thanks!
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #7 - Apr 14th, 2010 at 2:36pm
Print Post Print Post  
This problem also occurs in @MSGBOX() command. (text in the message box is dropped after the '@' symbol.)
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Printstring errors
Reply #8 - Apr 14th, 2010 at 5:19pm
Print Post Print Post  
Steve_in_Texas wrote on Apr 14th, 2010 at 2:36pm:
This problem also occurs in @MSGBOX() command. (text in the message box is dropped after the '@' symbol.)

Yes. In most cases, you'll need to double @ to prevent it from being interpreted as a formatting code. We're looking at the wrapping issue.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Printstring errors
Reply #9 - Apr 14th, 2010 at 5:49pm
Print Post Print Post  
The "@" is a command introduction character in the GUI that Sesame uses. So while it can be used to cause certain effects, it is not documented or recommended in that it is not a Sesame command but a command of the underlying GUI library. For example, in some types of "widgets" the following commands can be introduced using the "@" sign:

   * @. Print rest of line, don't look for more '@' signs
   * @@ Print rest of line starting with '@'
   * @l Use a large (24 point) font
   * @m Use a medium large (18 point) font
   * @s Use a small (11 point) font
   * @b Use a bold font (adds FL_BOLD to font)
   * @i Use an italic font (adds FL_ITALIC to font)
   * @f or @t Use a fixed-pitch font (sets font to FL_COURIER)
   * @c Center the line horizontally
   * @r Right-justify the text
   * @B0, @B1, ... @B255 Fill the backgound with fl_color(n)
   * @C0, @C1, ... @C255 Use fl_color(n) to draw the text
   * @F0, @F1, ... Use fl_font(n) to draw the text
   * @S1, @S2, ... Use point size n to draw the text
   * @u or @_ Underline the text.
   * @- draw an engraved line through the middle.

In some other "widgets" the @ sign can be used to make arrows or other symbols appear. This is why it is necessary to double the "@" sign, so as to tell the GUI that you are not introducing a command. I believe that this has appeared here in the forum before and may well have appeared in Inside Sesame.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring errors
Reply #10 - Apr 15th, 2010 at 3:46pm
Print Post Print Post  
Thanks for the insight folks.
  
Back to top
IP Logged