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 


Barebones WYSIWYG HTML Editor

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 Source Code
View previous topic :: View next topic  
Author Message
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 686
Location: Evansville, IN

PostPosted: Mon Apr 11, 2011 4:16 am    Post subject: Barebones WYSIWYG HTML Editor Reply with quote

Relies on DOM DSU located here:

http://www.vdsworld.com/forum/viewtopic.php?p=36186

DSC file MUST be saved for code to work.

barebones.dsc
Code:
 external vdsbrw50.dll
 #include vdsdom50.dsu
#define command,browser
#define function,browser
title cnodnarb's BareBones WYSIWYG HTML Editor
  DIALOG CREATE,cnodnarb's BareBones WYSIWYG HTML Editor,-1,0,341,225,RESIZABLE
REM *** Modified by Dialog Designer on 4/10/2011 - 22:48 ***
  DIALOG ADD,browser,Browser1,0,0,100,200,""
 dialog add,menu,&File,&New,&Open,&Save,&Save As
 dialog add,menu,&Format,&Font,&Bold,&Italic,&Underline
  DIALOG ADD,STATUS,status1
  DIALOG ADD,TRACKBAR,TRACKBAR1,138,149,180,50,50,,,,BOTH
  DIALOG SHOW
 
  dialog set,browser1,<html><body><div></div></body></html>
  browser savefile,browser1,@path(%0)test.html
  dialog set,browser1,@path(%0)test.html 
    setattribute browser1,tag,body,contentEditable,True,0
  :timer
   repeat
  until @null(@browser(browser1,busy))
  if @equal(%%x,0)
  dialog set,trackbar1,1
  end
 
  if @not(@equal(%%x,@dlgtext(trackbar1)))
 browserzoom browser1,@fmul(@dlgtext(trackbar1),2)
    end
 

  :evloop
  %%x = @dlgtext(trackbar1)
  if %%file
  dialog title,@name(%%file) - cnodnarb's BareBones WYSIWYG HTML Editor
  end
    wait event,.1
    %%event = @event()
    dialog set,status1,%%event
  goto %%event
 
  :fontmenu
  %%input = @input(Insert Font Name)
  if %%input
  execcommand browser1,"'FontName',false,"'%%input'
  end
  goto evloop
 
  :boldmenu
  execcommand browser1,"'Bold'"
  goto evloop
 
    :italicmenu
  execcommand browser1,"'Italic'"
  goto evloop
 
    :underlinemenu
  execcommand browser1,"'Underline'"
  goto evloop
 
  :save asmenu
  %%ask = @ask("Warning, saving with @getlargeattribute() may modify contents of clipboard, do you wish to continue?")
  if @null(%%ask)
  info Save aborted. Clipboard unmodified.
  goto evloop
  end
  setattribute browser1,tag,body,contentEditable,False,0
  browserzoom browser1,100
  dialog set,browser1,@getlargeattribute(browser1,tag,html,outerHTML,0)
  %%filedlg = @filedlg()
  if %%filedlg
  browser savefile,browser1,%%filedlg
  setattribute browser1,tag,body,contentEditable,True,0
  browserzoom browser1,@fmul(@dlgtext(trackbar1),2)
  %%file = %%filedlg
  else
  info Save aborted.
  end
  goto evloop
 
  :savemenu
  if %%file
  rem do nothing
  else
  goto save asmenu
  end
   %%ask = @ask("Warning, saving with @getlargeattribute() may modify contents of clipboard, do you wish to continue?")
  if @null(%%ask)
  info Save aborted. Clipboard unmodified.
  goto evloop
  end
  setattribute browser1,tag,body,contentEditable,False,0
  browserzoom browser1,100
    dialog set,browser1,@getlargeattribute(browser1,tag,html,outerHTML,0)
      browser savefile,browser1,%%file
      browserzoom browser1,@fmul(@dlgtext(trackbar1),2)
      setattribute browser1,tag,body,contentEditable,True,0
      goto evloop
     
  :openmenu
  %%file = @filedlg()
  if %%file
  dialog set,browser1,%%file
  setattribute browser1,tag,body,contentEditable,True,0
  dialog set,trackbar1,50
  end
  goto evloop
 
  :newmenu
  %%file = ""
  dialog set,browser1,<html><body><div></div></body></html>
  browser savefile,browser1,@path(%0)test.html
  dialog set,browser1,@path(%0)test.html 
    setattribute browser1,tag,body,contentEditable,True,0
    dialog set,trackbar1,50
    goto evloop
 
  :close
  exit
 
  :resize
  dialog setpos,browser1,0,0,@dlgpos(,w),@diff(@dlgpos(,h),20)
  dialog setpos,trackbar1,@diff(@dlgpos(,h),90),@diff(@dlgpos(,w),200),
  goto evloop
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 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