Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simulating RightClick in RTF Box control
Message
From
31/08/2006 09:04:34
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
31/08/2006 08:32:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01150005
Message ID:
01150110
Views:
40
>>Any ideas?
>>
>>Update: while it doesn't work as specified, I managed to have it pass parameters to a bindevent()ed method in the form. Go figure.
>
>
>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
>
>  Procedure myRTF.MouseDown
>    Lparameters Button, Shift, x, Y
>    If m.button = 2
>      Thisform.RTFShortCut(This)
>    Endif
>  Endproc
>
>  Procedure RTFShortCut(oRef)
>Define Popup rtfShCut SHORTCUT Relative From Mrow(),Mcol()
>Define Bar 1 Of rtfShCut Prompt 'Toggle Bold'
>Define Bar 2 Of rtfShCut Prompt 'Toggle Italic'
>Define Bar 3 Of rtfShCut Prompt 'Toggle Underline'
>
>On Selection Bar 1 Of rtfShCut oRef.SelBold = !oRef.SelBold
>On Selection Bar 2 Of rtfShCut oRef.SelItalic = !oRef.SelItalic
>On Selection Bar 3 Of rtfShCut oRef.SelUnderline = !oRef.SelUnderline
>Activate Popup rtfShCut
>Endproc
>Enddefine
>
Cetin

Thanks - my problem was that the parameters for .mouseup weren't passed, but then they were passed to a bindevent()ed code, which was weird.

Anyway, in my case it wasn't the formatting menu that I needed, but editing instead (and the RTF text is actually read only by nature, if not by setting), and Sergey pointed me in the right direction for this, in the other thread.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform