Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use rtf sample
Message
From
17/07/2006 06:35:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
01136615
Message ID:
01136886
Views:
60
>>>This is a basic question.
>>>
>>>I want a form with just an RTF control and the controls above it for font selection, size, color and characteristics.
>>>
>>>I see the RTF example in the VFP sample application. I don't know how to make a form with just these items - whatever I tried it always refers back to the sample vcx, which contains lots of other stuff.
>>>
>>>Can someone give me a simple step-by-step, or email me with the form?
>>>
>>>One other thing - in the sample application, when you select a word and then apply say Bold, it removes the selection indicator. But if you then choose say Italic it acts upon the same selection as before. Can one have the words previously selected again show as selected after applying the Bold, etc.?
>>>
>>>Cyril
>>
>>Cyril,
>>Below sample, though doesn't show all the capabilities of RTF control, doesn't use any external classes so should be easier to understand.
>>
>>Public oForm
>>oForm = Createobject('myForm')
>>oForm.Show
>>
>>Define Class myForm As Form
>>  Height = 400
>>  Width = 800
>>  DataSession = 2
>>  Caption = "RTF sample"
>>
>>  Add Object myGrid As Grid With ;
>>    top=0,Left=0,Height=400,Width=200,;
>>    recordsource='crsEmployee',ColumnCount=2
>>  Add Object myRTF As OleControl With ;
>>    OleClass="RICHTEXT.RichTextCtrl.1",;
>>    Left=210,Top = 10, Height=300,Width=580
>>  Add Object cmdRTF As CommandGroup With ;
>>    Left = 210,Top = 320,ButtonCount=5
>>
>>  Procedure Load
>>    * Use employee notes as ready sample text source
>>    Select first_name,last_name,notes,notes As rtfNotes ;
>>      FROM (_samples+'data\employee') ;
>>      INTO Cursor crsEmployee ;
>>      readwrite
>>  Endproc
>>
>>  Procedure Init
>>    With This.cmdRTF && add buttons to RTF button group
>>      .Buttons(1).Caption = "Toggle Bold"
>>      .Buttons(2).Caption = "Toggle Italic"
>>      .Buttons(3).Caption = "Toggle Underline"
>>      .Buttons(4).Caption = "Font"
>>      .Buttons(5).Caption = "Color"
>>      .SetAll('AutoSize',.T.)
>>      .SetAll("Top",2,'CommandButton')
>>      For ix = 2 To .ButtonCount
>>        .Buttons(m.ix).Left = .Buttons(m.ix-1).Left + .Buttons(m.ix-1).Width + 2
>>      Endfor
>>      .AutoSize = .T.
>>    Endwith
>>
>>    With This.myRTF && Bind RTF controlsource to rtfNotes memo
>>      .ControlSource = "crsEmployee.rtfNotes"
>>      .HideSelection = .F. && default .t. hides selection after a SelOperation
>>    Endwith
>>  Endproc
>>
>>  Procedure myGrid.AfterRowColChange
>>    Lparameters nColindex
>>    Thisform.Refresh()
>>  Endproc
>>
>>  Procedure cmdRTF.Click
>>    With This.Parent.myRTF
>>      Do Case
>>        Case This.Value = 1 && bold
>>          .SelBold = !.SelBold
>>        Case This.Value = 2 && italic
>>          .SelItalic = !.SelItalic
>>        Case This.Value = 3 && underline
>>          .SelUnderline = !.SelUnderline
>>        Case This.Value = 4 && Font
>>          lcFont = Getfont()
>>          .SelFontName = Getwordnum(m.lcFont,1,',')
>>          .SelFontSize = Val(Getwordnum(m.lcFont,2,','))
>>          .SelBold = ( 'B'$Getwordnum(m.lcFont,3,',') )
>>          .SelItalic = ( 'I'$Getwordnum(m.lcFont,3,',') )
>>        Case This.Value = 5 && color
>>          .SelColor = Getcolor()
>>      Endcase
>>    Endwith
>>  Endproc
>>Enddefine
>>
Cetin
>
>
>Hi Cetin
>
>Thanks, this is an easy to understand example.
>
>In the sample application:
>MODIFY FORM (HOME(2) + 'Solution\OLE\Rtf')
>There is are neat combo's for the font name and size. Can you show me how to add these to your example prg?
>
>Thanks
>Cyril

Sorry, I don't have time for that. You can directly use that conatiner class if you want. Otherwise it's a simple combo listing fonts available.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform