PureBasic Forum
http://forums.purebasic.com/english/

[Done] ~"\t" Doesn't work in VectorDrawing, Windows 10
http://forums.purebasic.com/english/viewtopic.php?f=37&t=67482
Page 1 of 1

Author:  davido [ Sun Jan 15, 2017 12:01 am ]
Post subject:  [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10

The following code works as expected on Mac OSX but not on Windows.

Tested on Windows 10 with PureBasic 5.50 64 bit and PureBasic 5.51 64 bit.

Code:
EnableExplicit

  CompilerIf #PB_Compiler_Unicode
    #XmlEncoding = #PB_UTF8
  CompilerElse
    #XmlEncoding = #PB_Ascii
  CompilerEndIf

  #Dialog = 0
  #Xml = 0
  Global XML$, Event.i
 
 
  EnableExplicit
 
  Runtime Enumeration ;Windows
    #WinMain
  EndEnumeration
  Runtime Enumeration ;Gadgets
    #CanvasTest
  EndEnumeration
 
    Runtime Enumeration ;Fonts
    #VFont_01
  EndEnumeration
 
  Runtime Procedure SetUP()
    Protected T$
    LoadFont(#VFont_01,"Arial",48)
   
    If StartVectorDrawing(CanvasVectorOutput(#CanvasTest))
      VectorFont(FontID(#VFont_01),20)
      T$ = ~"EscapeString\t\tTab test"
      VectorSourceColor($FF0000FF)
      MovePathCursor(10,10)
      DrawVectorText(T$)
     
      MovePathCursor(10,50)
      T$ + ~"\n" + T$
      DrawVectorParagraph(T$,200,72)
      StopVectorDrawing()
    Else
      MessageRequester("ERROR!","Cannot invoke Vector Drawing")
    EndIf
  EndProcedure
 
  XML$ = "<dialogs>"+
         "  <window id='#WinMain' name='CanvasTest' text='CanvasTest' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered |"+
         "  #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
         "    <canvas id='#CanvasTest' height='250' width='250' />"+
         "  </window>"+
         "</dialogs>"
 
  If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
   
    If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "CanvasTest")
      SetUp()
      Repeat
        Event = WaitWindowEvent()
      Until Event = #PB_Event_CloseWindow
     
    Else 
      Debug "Dialog error: " + DialogError(#Dialog)
    EndIf
  Else
    Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
  EndIf

Author:  Mistrel [ Sun Jan 15, 2017 1:33 am ]
Post subject:  Re: ~"\t" Doesn't work in VectorDrawing, Windows 10

I'm not sure why it would work even on MacOS. PureBasic doesn't use escape sequences in strings.

Try:

Code:
String.s="Some"+#TAB$+"Thing"

Author:  Dude [ Sun Jan 15, 2017 3:26 am ]
Post subject:  Re: ~"\t" Doesn't work in VectorDrawing, Windows 10

Mistrel wrote:
PureBasic doesn't use escape sequences in strings.

Yes it does; it was added in the 5.40 release. Check this out:

Code:
string$=~"abc\t123"
Debug string$ ; Shows "abc   123"

Author:  Fred [ Tue Aug 01, 2017 8:34 am ]
Post subject:  Re: ~"\t" Doesn't work in VectorDrawing, Windows 10

Seems to be a limitation on GDI+, it doesn't handle tab unless you specify some tabstop array: https://docs.microsoft.com/en-us/dotnet ... drawn-text . It's no help for us here, as we don't know where to position the stop. Moved to doc for proper documentation

Author:  Mesa [ Fri Dec 07, 2018 6:17 pm ]
Post subject:  Re: [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10

Added some words concerning Windows.

Author:  davido [ Fri Dec 07, 2018 11:30 pm ]
Post subject:  Re: [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10

Thank you.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/