WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

COMCONTROL
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

RTF COMCONTROL in Dialog


I tested this updated control and it worked well as a COMCONTROL in a dialog. The ocx is free to use, but out of respect for the author's wishes, the script header references his site where you can download it.

The ocx has methods, properties and events that make it comparable to Wordpad.

http://www.jsware.net/jsware/scripts.php5#jsrtb

;Winbatch 2006D Beta - Yet another free RTF ActiveX Control
;
;This is very basic, but doesn't crash at this point
;The jsRTB.ocx must be registered. see below how to obtain it
;
; The control
; Stan Littlefield, October 15, 2006
;/////////////////////////////////////////////////////////////////////////

;Obtaining the ocx - from the author
; "I ask only that you not redistribute these scripts and components,
;  except as required for your direct use. Instead, please direct others
;  to obtain copies of JSWare scripts and components directly from www.jsware.net."

;////////////////////////////////////////////////////////////////////////////////////////
GoSub udfs
RTFFormat=`WWWDLGED,6.1`
RTFCaption=`Winbatch RTF Control`
RTFX=9999
RTFY=9999
RTFWidth=308
RTFHeight=207
RTFNumControls=007
RTFProcedure=`dlgproc`
RTFFont=`Microsoft Sans Serif|6144|70|34`
RTFTextColor=`0|0|0`
RTFBackground=`DEFAULT,252|253|204`
RTFConfig=0
RTF001=`001,001,036,012,PUSHBUTTON,DEFAULT,"Load",1,1,32,DEFAULT,DEFAULT,"252|253|204"`
RTF002=`039,001,036,012,PUSHBUTTON,DEFAULT,"Save",2,2,DEFAULT,DEFAULT,DEFAULT,"252|253|204"`
RTF003=`001,015,302,188,COMCONTROL,DEFAULT,"jsRTB.RTB",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
RTF004=`079,001,036,012,PUSHBUTTON,DEFAULT,"Font",3,4,DEFAULT,DEFAULT,DEFAULT,"252|253|204"`
RTF005=`119,001,036,012,PUSHBUTTON,DEFAULT,"Color",4,5,DEFAULT,DEFAULT,DEFAULT,"252|253|204"`
RTF006=`159,001,036,012,PUSHBUTTON,DEFAULT,"Select",5,6,DEFAULT,DEFAULT,DEFAULT,"252|253|204"`
RTF007=`265,001,036,012,PUSHBUTTON,DEFAULT,"Quit",6,7,DEFAULT,DEFAULT,DEFAULT,"252|253|204"`
ButtonPushed=Dialog("RTF")

Exit

:udfs
#DefineSubRoutine dlgproc(handle,msg,id,p4,p5)
Switch msg
   Case 0  ;Dialog Initialization
      hwnd=handle
      DialogProcOptions(handle, 2,1)
      oRTF = DialogObject(handle,003,3)
      rtfinit()
      SetErrorMode(1|2|32768)
      Return(-1)
   Case 2
      Switch id
         Case 7
            oRTF=0
            Return(9)
      EndSwitch
EndSwitch
Return -2

#EndSubRoutine

#DefineSubRoutine rtfinit()
oRTF.BackColor = rgb(252,253,204,1) ;must be a hex string
oRTF.MenuVisible = @TRUE
oRTF.Wordwrap = @TRUE
oRTF.FontName = "Tahoma"
oRTF.FontSize = 14
oRTF.FontColor = rgb(0,128,255,0)
oRTF.Text = "This is Test for an ActiveX RTF Control"
oRTF.setfocus()
oRTF.refresh()
Return(1)
#EndSubRoutine


#DefineFunction SetErrorMode(nMode)

   ; Get kernel 32 dll path.
   sKernel32 = StrCat(DirWindows(1),"kernel32.dll")

   Return DllCall(sKernel32, long:"SetErrorMode", long:nMode)
#EndFunction

#DefineFunction RGB(r, g, b, asHex)
If asHex
   Return( StrCat( DecToHex(r),DecToHex(g),DecToHex(b) ) )
Else
   Return r|(g<<8)|(b<<16)
EndIf
#EndFunction

#DefineFunction DecToHex(num)
cHex = "0123456789ABCDEF"
str = ""
iZ = 1
For i=7 To 0 By -1
   In = (num>>(i*4))&15
   If In==0 && iZ==1 Then Continue
   iZ = 0
   str = StrCat( str,StrSub(cHex,In+1,1) )
Next
Return(str)
#EndFunction


Return

Article ID:   W16932
File Created: 2012:03:12:10:16:50
Last Updated: 2012:03:12:10:16:50