Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting VB code to VFP
Message
From
13/11/2003 18:19:58
 
 
To
13/11/2003 17:59:20
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00849707
Message ID:
00849715
Views:
40
This message has been marked as the solution to the initial question of the thread.
PROCEDURE RegisterCustomLanguage
LPARAMETERS loCodeMaxCtl

LOCAL lang AS CodeMaxCtl.Language

lang = CREATEOBJECT("CodemaxCtl.Language")
lang.CaseSensitive = .T.
LOCAL lcStr AS String

    lcstr = "for" + Chr$(10) + "friend" + Chr$(10) + "goto"
    lcstr = lcstr + Chr$(10) + "if" + Chr$(10) + "inline" + Chr$(10) + "int"
    lcstr = lcstr + Chr$(10) + "long" + Chr$(10) + "return" + Chr$(10) + "short"
    lcstr = lcstr + Chr$(10) + "signed" + Chr$(10) + "sizeof" 
    lcstr = lcstr + Chr$(10) + "static" + "while" + Chr$(10) + "xalloc" 
    lcstr = lcstr + Chr$(10) + "new" + Chr$(10) + "delete"

    lang.Keywords = lcstr

    lcstr = "::" + Chr$(10) + "." + Chr$(10) + "->"
    lcstr = lcstr + Chr$(10) + "++" + Chr$(10) + "--" + Chr$(10) + "*"
    lcstr = lcstr + Chr$(10) + "&" + Chr$(10) + "+" + Chr$(10) + "-"
    lcstr = lcstr + Chr$(10) + "!" + Chr$(10) + "~" + Chr$(10) + "sizeof"


    lang.Style = cmLangStyleProcedural
    lang.Operators = lcstr
    lang.SingleLineComments = "//"
    lang.MultiLineComments1 = "/*"
    lang.MultiLineComments2 = "*/"
    lang.ScopeKeywords1 = "{"
    lang.ScopeKeywords2 = "}"
    lang.StringDelims = Chr$(34) + Chr$(10) + "'"
    lang.EscapeChar = "\"
    lang.TerminatorChar = ";"

    LOCAL globals AS CodeMaxCtl.globals
    globals = CREATEOBJECT("CodeMaxCtl.globals")
    globals.RegisterLanguage("MyOwnC++",lang)
    **** Control.Language = "MyOwnC++"
    *** ?? Thisform.Control.Object.Language ????
If your are using a minor version than VFP7, dont use AS. You will need to generate an .H file of your control(s) to get cmLangStyleProcedural constant. To get it use the Object Browser.


HTH
>Hi all,

>I'm hoping someone can help me convert this small VB routine to Visual FoxPro. This routine is out of a readme file for an ActiveX control I'm trying to use, but I am not proficient enough in VB myself to convert. Any help appreciated.
Private Sub RegisterCustomLanguage(ByVal Control As CodeMaxCtl.ICodeMax)
    Dim lang As CodeMaxCtl.Language
    Set lang = New CodeMaxCtl.Language
    lang.CaseSensitive = True

    Dim str As String
    str = "for" + Chr$(10) + "friend" + Chr$(10) + "goto"
    str = str + Chr$(10) + "if" + Chr$(10) + "inline" + Chr$(10) + "int"
    str = str + Chr$(10) + "long" + Chr$(10) + "return" + Chr$(10) + "short"
    str = str + Chr$(10) + "signed" + Chr$(10) + "sizeof" 
    str = str + Chr$(10) + "static" + "while" + Chr$(10) + "xalloc" 
    str = str + Chr$(10) + "new" + Chr$(10) + "delete"

    lang.Keywords = str

    str = "::" + Chr$(10) + "." + Chr$(10) + "->"
    str = str + Chr$(10) + "++" + Chr$(10) + "--" + Chr$(10) + "*"
    str = str + Chr$(10) + "&" + Chr$(10) + "+" + Chr$(10) + "-"
    str = str + Chr$(10) + "!" + Chr$(10) + "~" + Chr$(10) + "sizeof"

    lang.Style = cmLangStyleProcedural
    lang.Operators = str
    lang.SingleLineComments = "//"
    lang.MultiLineComments1 = "/*"
    lang.MultiLineComments2 = "*/"
    lang.ScopeKeywords1 = "{"
    lang.ScopeKeywords2 = "}"
    lang.StringDelims = Chr$(34) + Chr$(10) + "'"
    lang.EscapeChar = "\"
    lang.TerminatorChar = ";"

    Dim globals As CodeMaxCtl.globals
    Set globals = New CodeMaxCtl.globals
    Call globals.RegisterLanguage("MyOwnC++", lang)
    Control.Language = "MyOwnC++"
End Sub
Apoya a Visual FoxPro usandolo legalmente
--
¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º
Espartaco Palma Martínez
SysOp PortalFox
http://www.portalfox.com
esparta@portalfox.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform