Announcement

Collapse
No announcement yet.

Create Set/Get properties with limited typing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create Set/Get properties with limited typing

    I forgot to post this after the 9.01 release that had changes to the CLIPBOARD.
    Purpose: As The Thread title reads; To create get/set properties with limited typing. It will compile and run with either 9.01/5.01 just note the PBCC commented lines in the source.
    I chose to post here instead of the source code forum as it's just a few lines of down and dirty useful code.
    James
    Code:
    'SED_PBWIN
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    'Create Set/Get properties with limited typing
    '------------------------------------------------------------------------------
    'UpDate Feb 18, 2009
    'Added GETSET for both
    '------------------------------------------------------------------------------
    'James C. Fuller Feb 16, 2009
    '******************************************************************************
    'Input format: Indentspaces Highlighted,Get | Set | GetSet,PropName,PropType
    'Highlight text including indent spaces and copy to clipboard -> I use Ctrl/Insert
    'Run program
    'Then paste: I use Shift/Insert
    'Example line to highlight ( minus the comment marker ')
    '          ,Set,hCtl,DWORD
    'Results when pasted ( without the ')
    '          PROPERTY SET hCtl ALIAS "hCtl"(BYVAL Param AS DWORD)
    '              hCtl = Param
    '          END PROPERTY
    '
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    #COMPILE EXE "MKPROP.EXE"
    #DIM ALL
    '#CONSOLE OFF
    FUNCTION PBMAIN() AS LONG
        LOCAL S1,Dt,gors,pname,S2,Indent AS STRING
    
         CLIPBOARD GET TEXT S1
         Indent = PARSE$(S1,",",1)
         gors = UCASE$(PARSE$(S1,",",2))
         pname = PARSE$(S1,",",3)
         dt = PARSE$(S1,",",4)
        IF gors = "GETSET" THEN
            S2 = BUILD$(Indent,"PROPERTY GET ",pname," ALIAS ",$DQ,pname,$DQ,"()AS ",dt,$CRLF, _
                        Indent,"    PROPERTY = ",pname,$CRLF,Indent,"END PROPERTY",$CRLF, _
                        Indent,"PROPERTY SET ",pname," ALIAS ",$DQ,pname,$DQ,"(BYVAL Param AS ",dt,")",$CRLF, _
                        Indent,"    ",pname," = Param" ,$CRLF,Indent,"END PROPERTY",$CRLF)
        ELSEIF gors = "SET" THEN
            S2 = BUILD$(Indent,"PROPERTY SET ",pname," ALIAS ",$DQ,pname,$DQ,"(BYVAL Param AS ",dt,")",$CRLF, _
                        Indent,"    ",pname," = Param" ,$CRLF,Indent,"END PROPERTY",$CRLF)
        ELSEIF gors = "GET" THEN
            S2 = BUILD$(Indent,"PROPERTY GET ",pname," ALIAS ",$DQ,pname,$DQ,"()AS ",dt,$CRLF, _
                        Indent,"    PROPERTY = ",pname,$CRLF,Indent,"END PROPERTY",$CRLF)
        ELSE
            S2 = "No Match"
        END IF
        CLIPBOARD RESET
        CLIPBOARD SET TEXT S2
        'WAITKEY$
    END FUNCTION
Working...
X