forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Wordwrap

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu Aug 01, 2002 3:29 am    Post subject: Wordwrap Reply with quote

I'll be using this program for wordwrapping my input to this forum, so that no more
hugely long lines would appear if someone would have posted a script in the same
topic, causing the browser's built-in wordwrapping functionality to fail.

I'm sure this could be useful for other purposes too. Just select the correct pixel
width and font and make sure that vdsimage.dll is available.

Code:

  rem for VDS 4 and up only.
  rem will need some modifications related to WHILE loops for VDS 3.
  external vdsimage.dll
  %%maxwidth = 526
  %%font = Verdana
  %%size = 9
  %%attributes =
  DIALOG CREATE,Wordwrap,-1,0,552,304
  DIALOG ADD,STYLE,sStyle,%%font,%%size,%%attributes,,
  DIALOG ADD,EDIT,eText,8,8,536,256,,,MULTI,sStyle
  DIALOG ADD,BUTTON,bProcess,272,448,88,24,&Process
  DIALOG SHOW
:evloop
  wait event
  goto @event()
:bProcessbutton
  list create,1
  list assign,1,@dlgtext(eText)
  list create,2
  %i = 0
  %%nextline =
  repeat
    %%nextline = @trim(@item(1,%i))
    gosub addnextline
    %i = @succ(%i)
  until @equal(%i,@count(1))
  if %%nextline
    gosub addnextline
  end
  dialog set,eText,@text(2)
  list close,2
  list close,1
  goto evloop
:processline
  %%nextline =
  while @both(@greater(@image(textwidth,%%line,%%font,%%size,%%attributes),%%maxwidth),@greater(@pos(" ",%%line),0))
    %j = @len(%%line)
    repeat
      %j = @pred(%j)
    until @equal(@substr(%%line,%j)," ")
    %%nextline = @substr(%%line,@succ(%j),@len(%%line))" "%%nextline
    %%line = @strdel(%%line,%j,@len(%%line))
  wend
  exit
:addnextline
  if %%nextline
    while %%nextline
      %%line = %%nextline
      gosub processline
      list add,2,@trim(%%line)
    wend
  else
    list add,2,
  end
  exit
:close
  exit
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group