It is currently Sat Mar 23, 2019 9:21 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Sun Jan 15, 2017 12:01 am 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1635
Location: Uttoxeter, UK
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

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Sun Jan 15, 2017 1:33 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3237
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"

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Sun Jan 15, 2017 3:26 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1848
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"


Top
 Profile  
Reply with quote  
 Post subject: Re: ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Tue Aug 01, 2017 8:34 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13496
Location: France
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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Fri Dec 07, 2018 6:17 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 24, 2012 10:19 am
Posts: 105
Added some words concerning Windows.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] ~"\t" Doesn't work in VectorDrawing, Windows 10
PostPosted: Fri Dec 07, 2018 11:30 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1635
Location: Uttoxeter, UK
Thank you.

_________________
DE AA EB


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye