Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ocx Calculator needed
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01021244
Message ID:
01021340
Views:
19
Borislav,

Nice job! I just ran this code. I find the scrolling history and the clipboard functions are very useful. Thanks for posting it.

>Here is the same calculator with small improvements (very small indeed). I remove some comments that was on Bulgarian, Remove checks for Bulgarian letters in KeyPress Event, put SetFocus() to the button when you works only with keyboard (Unfortunately I don't have a time to see how to simulate visual CLICK on them):
>
>
>M1 = CREATEOBJECT("cALC")
>M1.sHOW(1)
>
>
>
>**************************************************
>*-- Class:        calc
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   08/06/05 15:31:14
>*
>DEFINE CLASS calc AS form
>
>    Top = 0
>    Left = 0
>    Height = 344
>    Width = 189
>    DoCreate = .T.
>    ShowTips = .T.
>    BorderStyle = 1
>    Caption = "Calculator"
>    Closable = .F.
>    FontSize = 8
>    MaxButton = .F.
>    MinButton = .F.
>    KeyPreview = .T.
>    BackColor = RGB(116,116,116)
>    memoval = 0
>    result = 0
>    znak = ("")
>    br_rows = 0
>    Name = "calc"
>    blockade = .F.
>    fl_znak = .F.
>    memoclick = .F.
>
>    ADD OBJECT b7 AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 40, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "7", ;
>        TabIndex = 10, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B7"
>
>
>    ADD OBJECT b8 AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 68, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "8", ;
>        TabIndex = 11, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B8"
>
>
>    ADD OBJECT b9 AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 96, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "9", ;
>        TabIndex = 12, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B9"
>
>
>    ADD OBJECT b4 AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 40, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "4", ;
>        TabIndex = 7, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B4"
>
>
>    ADD OBJECT b5 AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 68, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "5", ;
>        TabIndex = 8, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B5"
>
>
>    ADD OBJECT b6 AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 96, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "6", ;
>        TabIndex = 9, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B6"
>
>
>    ADD OBJECT b1 AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 40, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "1", ;
>        TabIndex = 4, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B1"
>
>
>    ADD OBJECT b2 AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 68, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "2", ;
>        TabIndex = 5, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B2"
>
>
>    ADD OBJECT b3 AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 96, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "3", ;
>        TabIndex = 6, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B3"
>
>
>    ADD OBJECT b0 AS commandbutton WITH ;
>        Top = 292, ;
>        Left = 40, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "0", ;
>        TabIndex = 1, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B0"
>
>
>    ADD OBJECT b00 AS commandbutton WITH ;
>        Top = 292, ;
>        Left = 68, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "00", ;
>        TabIndex = 2, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "B00"
>
>
>    ADD OBJECT plus AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 129, ;
>        Height = 50, ;
>        Width = 25, ;
>        Caption = "+", ;
>        TabIndex = 13, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "PLUS"
>
>
>    ADD OBJECT minus AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 129, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "-", ;
>        TabIndex = 15, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "MINUS"
>
>
>    ADD OBJECT multi AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 129, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "*", ;
>        TabIndex = 17, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "MULTI"
>
>
>    ADD OBJECT divide AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 157, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "/", ;
>        TabIndex = 16, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "DIVIDE"
>
>
>    ADD OBJECT memorecall AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 40, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "MR", ;
>        TabIndex = 23, ;
>        SpecialEffect = 2, ;
>        Name = "MEMORECALL"
>
>
>    ADD OBJECT memominus AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 68, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "M-", ;
>        TabIndex = 21, ;
>        SpecialEffect = 2, ;
>        Name = "MEMOMINUS"
>
>
>    ADD OBJECT memoplus AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 96, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "M+", ;
>        TabIndex = 22, ;
>        SpecialEffect = 2, ;
>        Name = "MEMOPLUS"
>
>
>    ADD OBJECT percent AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 157, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "%", ;
>        TabIndex = 19, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "PERCENT"
>
>
>    ADD OBJECT bpoint AS commandbutton WITH ;
>        Top = 292, ;
>        Left = 96, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = ".", ;
>        TabIndex = 3, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(0,0,255), ;
>        Name = "BPOINT"
>
>
>    ADD OBJECT ac AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 6, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "AC", ;
>        TabIndex = 27, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,0), ;
>        Name = "AC"
>
>
>    ADD OBJECT off AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 6, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "OFF", ;
>        TabIndex = 26, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,0), ;
>        Name = "OFF"
>
>
>    ADD OBJECT back AS commandbutton WITH ;
>        Top = 241, ;
>        Left = 6, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontName = "Symbol", ;
>        FontSize = 8, ;
>        Caption = CHR(172), ;
>        TabIndex = 25, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,0), ;
>        Name = "BACK"
>
>
>    ADD OBJECT bc AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 6, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "C", ;
>        TabIndex = 24, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,0), ;
>        Name = "BC"
>
>
>    ADD OBJECT equal AS commandbutton WITH ;
>        Top = 267, ;
>        Left = 157, ;
>        Height = 50, ;
>        Width = 25, ;
>        Caption = (ALLTRIM("=")), ;
>        TabIndex = 14, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "EQUAL"
>
>
>    ADD OBJECT plusminus AS commandbutton WITH ;
>        Top = 189, ;
>        Left = 129, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "+/-", ;
>        TabIndex = 20, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "PLUSMINUS"
>
>
>    ADD OBJECT sqrt AS commandbutton WITH ;
>        Top = 215, ;
>        Left = 157, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontName = "Symbol", ;
>        FontSize = 8, ;
>        Caption = CHR(214), ;
>        TabIndex = 18, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,255), ;
>        Name = "SQRT"
>
>
>    ADD OBJECT enter AS textbox WITH ;
>        Alignment = 1, ;
>        Enabled = .F., ;
>        Height = 22, ;
>        Left = 40, ;
>        TabIndex = 29, ;
>        Top = 154, ;
>        Width = 142, ;
>        DisabledBackColor = RGB(170,170,255), ;
>        DisabledForeColor = RGB(0,0,0), ;
>        Name = "Enter"
>
>
>    ADD OBJECT text1 AS textbox WITH ;
>        FontSize = 8, ;
>        Alignment = 2, ;
>        Enabled = .F., ;
>        Height = 22, ;
>        Left = 6, ;
>        TabIndex = 30, ;
>        Top = 154, ;
>        Width = 27, ;
>        DisabledBackColor = RGB(192,192,192), ;
>        DisabledForeColor = RGB(0,0,0), ;
>        Name = "Text1"
>
>
>    ADD OBJECT lenta AS editbox WITH ;
>        Alignment = 1, ;
>        Height = 136, ;
>        Left = 6, ;
>        ReadOnly = .T., ;
>        ScrollBars = 0, ;
>        TabStop = .F., ;
>        Top = 11, ;
>        Width = 177, ;
>        DisabledBackColor = RGB(170,170,255), ;
>        DisabledForeColor = RGB(0,0,0), ;
>        Name = "Lenta"
>
>
>    ADD OBJECT fillbutt AS commandbutton WITH ;
>        Top = 292, ;
>        Left = 6, ;
>        Height = 25, ;
>        Width = 25, ;
>        FontSize = 8, ;
>        Caption = "F", ;
>        TabIndex = 24, ;
>        SpecialEffect = 2, ;
>        ForeColor = RGB(255,0,0), ;
>        Name = "FILLBUTT"
>
>    PROCEDURE calculate
>        SET EXACT ON
>        DO CASE
>           CASE thisform.Znak = "*"
>                thisform.Result = thisform.Result * VAL(thisform.Enter.Value)
>           CASE thisform.Znak = "+"
>                thisform.Result = thisform.Result + VAL(thisform.Enter.Value)
>           CASE thisform.Znak = "-"
>                thisform.Result = thisform.Result - VAL(thisform.Enter.Value)
>           CASE thisform.Znak = "/"
>                thisform.Result = thisform.Result / VAL(thisform.Enter.Value)
>           CASE thisform.Znak = "*%"
>                thisform.Result = thisform.Result * VAL(thisform.Enter.Value) / 100
>           CASE thisform.Znak = "+%"
>                thisform.Result = thisform.Result + (thisform.Result*VAL(thisform.Enter.Value) / 100)
>           CASE thisform.Znak = "-%"
>                thisform.Result = thisform.Result - (thisform.Result*VAL(thisform.Enter.Value) / 100)
>           CASE thisform.Znak = "/%"
>                thisform.Result = thisform.Result / VAL(thisform.Enter.Value) / 100
>        ENDCASE
>
>        asd     = ALLTRIM(STRTRAN(STR(thisform.Result,16,7),"0"," "))
>        m_point = AT(".",asd)
>        m_point = IIF(m_point=LEN(asd),0,LEN(asd)-m_point)
>        thisform.Enter.Value = ALLTRIM(STR(thisform.Result,16,m_point))
>        thisform.fl_znak = .f.
>    ENDPROC
>
>
>    PROCEDURE makelenta
>        #DEFINE CRLF CHR(13)+CHR(10)
>        LPARAMETERS m_znak
>
>        LOCAL m_sels,m_len
>        IF thisform.br_rows = 0
>           thisform.Lenta.Value = ALLTRIM(thisform.Enter.Value)+" "+m_znak
>        ELSE
>           thisform.Lenta.Value = thisform.Lenta.Value + CRLF + ALLTRIM(thisform.Enter.Value)+" "+m_znak
>        ENDIF
>        thisform.br_rows = thisform.br_rows + 1
>        IF thisform.br_rows > 7
>           thisform.Lenta.ScrollBars = 2
>        ENDIF
>        m_len  = LEN(thisform.Lenta.Value)
>        m_sels = RAT(CHR(10),thisform.Lenta.Value)
>        thisform.Lenta.SelStart  = m_sels+1
>        thisform.Lenta.SelLength = m_len - m_sels
>    ENDPROC
>
>
>
>    PROCEDURE KeyPress
>        LPARAMETERS nKeyCode, nShift
>        LOCAL oButton
>        oButton = ""
>        DO CASE
>           CASE nKeyCode < 0
>           CASE nKeyCode = 27 .AND. nShift = 0 && ESC
>                oButton = "thisform.OFF"
>           CASE BETWEEN(nKeyCode, 48, 57) .AND. nShift = 0 && press some digit
>                oButton = "thisform.B"+CHR(nKeyCode)
>           CASE INLIST(nKeyCode, 44, 46) .AND. nShift = 0 && Decimal point (no matter if it is point or comma
>                oButton = "thisform.BPOINT"
>           CASE nKeyCode = 127  .AND. nShift = 0 && BackSpace
>                oButton = "thisform.BACK"
>           CASE nKeyCode = 42  .AND. nShift = 0 &&  *
>                oButton = "thisform.MULTI"
>           CASE nKeyCode = 47  .AND. nShift = 0 &&  /
>                oButton = "thisform.DIVIDE"
>           CASE nKeyCode = 45  .AND. nShift = 0 &&  -
>                oButton = "thisform.MINUS"
>           CASE nKeyCode = 43  .AND. nShift = 0 &&  +
>                oButton = "thisform.PLUS"
>           CASE INLIST(nKeyCode, 13, 61)  .AND. nShift = 0 &&  Enter or =
>                NODEFAULT
>                oButton = "thisform.EQUAL"
>           CASE UPPER(CHR(nKeyCode)) == "C"  .AND. nShift = 0 &&  C (Clear)
>                oButton = "thisform.BC"
>           CASE UPPER(CHR(nKeyCode)) == "A" .AND. nShift = 0  &&  A (ll Clear)
>                oButton = "thisform.AC"
>           CASE UPPER(CHR(nKeyCode)) == "O" .AND. nShift = 0  &&  O (off)
>                oButton = "thisform.OFF"
>           CASE UPPER(CHR(nKeyCode)) == "F" .AND. nShift = 0  &&  F (Copy to Clipboard)
>                oButton = "thisform.FILLBUTT"
>           CASE nKeyCode = 37                                 &&  % (Percent pressed)
>                oButton = "thisform.PERCENT"
>           CASE nKeyCode = 92  .AND. nShift = 0               &&  \ (SQRT)
>                oButton = "thisform.SQRT"
>           CASE nKeyCode = 43  .AND. nShift # 0               &&  Shift + (change the sign)
>                oButton = "thisform.PLUSMINUS"
>        ENDCASE
>        IF NOT EMPTY(oButton)
>           &oButton..SetFocus()
>           &oButton..Click()
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE Init
>        LPARAMETERS m_top,m_left
>        this.Top                        = IIF(TYPE("m_top") # "N" ,0,m_top)
>        this.Left                       = IIF(TYPE("m_left") # "N",0,m_left)
>    ENDPROC
>
>    PROCEDURE PressDidit(lcDigit)
>        thisform.MemoClick = .f.
>        IF .NOT. thisform.Blockade
>           IF .NOT. thisform.fl_znak
>              thisform.Enter.Value = lcDigit
>              thisform.fl_znak = .t.
>           ELSE
>              IF LEN(thisform.Enter.Value) < 16
>                 thisform.Enter.Value = thisform.Enter.Value + lcDigit
>              ENDIF
>           ENDIF
>        ENDIF
>
>    PROCEDURE b7.Click
>        thisform.PressDidit("7")
>    ENDPROC
>
>
>    PROCEDURE b8.Click
>        thisform.PressDidit("8")
>    ENDPROC
>
>
>    PROCEDURE b9.Click
>        thisform.PressDidit("9")
>    ENDPROC
>
>
>    PROCEDURE b4.Click
>        thisform.PressDidit("4")
>    ENDPROC
>
>
>    PROCEDURE b5.Click
>        thisform.PressDidit("5")
>    ENDPROC
>
>
>    PROCEDURE b6.Click
>        thisform.PressDidit("6")
>    ENDPROC
>
>
>    PROCEDURE b1.Click
>        thisform.PressDidit("1")
>    ENDPROC
>
>
>    PROCEDURE b2.Click
>        thisform.PressDidit("2")
>    ENDPROC
>
>
>    PROCEDURE b3.Click
>        thisform.PressDidit("3")
>    ENDPROC
>
>
>    PROCEDURE b0.Click
>        thisform.PressDidit("0")
>    ENDPROC
>
>
>    PROCEDURE b00.Click
>        thisform.PressDidit("00")
>    ENDPROC
>
>    PROCEDURE SignPress(lcSign)
>        IF .NOT. thisform.Blockade
>           thisform.MemoClick = .f.
>           thisform.MakeLenta(lcSign)
>           IF EMPTY(thisform.Znak)
>              thisform.Result = VAL(thisform.Enter.Value)
>           ELSE
>              ThisForm.Calculate()
>           ENDIF
>           thisform.Znak    = lcSign
>           thisform.fl_znak = .f.
>        ENDIF
>    RETURN
>
>    PROCEDURE plus.Click
>        thisform.SignPress("+")
>    ENDPROC
>
>
>    PROCEDURE minus.Click
>        thisform.SignPress("-")
>    ENDPROC
>
>
>    PROCEDURE multi.Click
>        thisform.SignPress("*")
>    ENDPROC
>
>
>    PROCEDURE divide.Click
>        thisform.SignPress("/")
>    ENDPROC
>
>
>    PROCEDURE memorecall.Click
>        LOCAL asd, m_point
>        IF .NOT. thisform.Blockade
>           IF thisform.MemoClick
>              thisform.Text1.Value =""
>              thisform.MemoVal = 0
>              thisform.MemoClick = .f.
>            ELSE
>               IF ROUND(thisform.MemoVal,14) = INT(thisform.MemoVal)
>                  m_point = 0
>               ELSE
>                 asd     = ALLTRIM(STRTRAN(STR(thisform.MemoVal,16,7),"0"," "))
>                 m_point = AT(".",asd)
>                 m_point = IIF(m_point=LEN(asd),0,LEN(asd)-m_point)
>               ENDIF
>               thisform.Enter.Value =  ALLTRIM(STR(thisform.MemoVal,16,m_point))
>               thisform.MemoClick = .t.
>            ENDIF
>            thisform.fl_znak = .f.
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE memominus.Click
>        IF .NOT. thisform.Blockade
>           IF .NOT. EMPTY(thisform.Znak)
>              thisform.Calculate()
>              thisform.MemoVal = thisform.MemoVal - thisform.Result
>           ELSE
>              thisform.MemoVal = thisform.MemoVal - thisform.Result
>           ENDIF
>           thisform.Text1.Value = "M"
>           thisform.MemoClick = .f.
>           thisform.fl_znak = .f.
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE memoplus.Click
>        IF .NOT. thisform.Blockade
>           IF .NOT. EMPTY(thisform.Znak)
>              thisform.Calculate()
>              thisform.MemoVal = thisform.MemoVal + thisform.Result
>           ELSE
>              thisform.MemoVal = thisform.MemoVal + thisform.Result
>           ENDIF
>           thisform.Text1.Value = "M"
>           thisform.MemoClick = .f.
>           thisform.fl_znak = .f.
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE percent.Click
>        IF .NOT. thisform.Blockade
>           thisform.MemoClick = .f.
>           thisform.MakeLenta("%")
>           IF .NOT. EMPTY(Thisform.Znak)
>              thisform.Znak = thisform.Znak + "%"
>              ThisForm.Calculate()
>           ENDIF
>           thisform.MakeLenta("=")
>           thisform.Znak = ""
>           thisform.fl_znak = .f.
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE bpoint.Click
>        thisform.MemoClick = .f.
>        IF EMPTY(AT(".",thisform.Enter.Value)) .OR.;
>           .NOT. thisform.fl_znak
>           IF EMPTY(thisform.Enter.Value) .OR.;
>              .NOT. thisform.fl_znak
>              thisform.Enter.Value = "0."
>              thisform.fl_znak     = .t.
>           ELSE
>             thisform.Enter.Value = thisform.Enter.Value + "."
>           ENDIF
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE ac.Click
>        thisform.Enter.Value = ""
>        thisform.Result   = 0
>        thisform.Blockade = .f.
>        thisform.fl_znak  = .f.
>        thisform.Znak     = .f.
>        thisform.Text1.DisabledForeColor = RGB(0,0,0)
>        thisform.Text1.Value = ""
>        thisform.Lenta.Value = ""
>        thisform.br_rows = 0
>        thisform.MemoVal = 0
>        thisform.Lenta.ScrollBars = 0
>        thisform.MemoClick = .f.
>    ENDPROC
>
>
>    PROCEDURE off.Click
>        thisform.Hide()
>    ENDPROC
>
>
>    PROCEDURE back.Click
>        LOCAL m_len
>        m_len = LEN(thisform.Enter.Value)
>        thisform.MemoClick = .f.
>        IF m_len = 1
>           thisform.Enter.Value = ""
>        ELSE
>           thisform.Enter.Value = LEFT(thisform.Enter.Value,LEN(thisform.Enter.Value)-1)
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE bc.Click
>        thisform.Enter.Value = ""
>        thisform.Blockade = .f.
>        thisform.fl_znak  = .f.
>        thisform.MemoClick = .f.
>        IF thisform.Text1.Value = "E"
>           thisform.Text1.DisabledForeColor = RGB(0,0,0)
>           thisform.Text1.Value = IIF(EMPTY(thisform.MemoVal),"","M")
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE equal.Click
>        IF .NOT. EMPTY(thisform.Znak) .AND. .NOT. thisform.Blockade
>           thisform.MemoClick = .f.
>           thisform.MakeLenta("=")
>           IF thisform.fl_znak .OR. .NOT. EMPTY(thisform.Znak)
>              ThisForm.Calculate()
>           ENDIF
>           thisform.MakeLenta("T"+CHR(13)+CHR(10))
>           thisform.Znak = ""
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE plusminus.Click
>        LOCAL m_point,m_len
>        m_len   = LEN(thisform.Enter.Value)
>        m_point = AT(".",thisform.Enter.Value)
>        m_point = IIF(m_point#0,m_len-m_point+IIF(VAL(thisform.Enter.Value)<0,0,1),0)
>        thisform.MemoClick = .f.
>        IF .NOT. EMPTY(VAL(thisform.Enter.Value))
>           thisform.Enter.Value = ALLTRIM(STR(VAL(thisform.Enter.Value) * (-1),m_len+1,m_point))
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE sqrt.Click
>        thisform.MemoClick = .f.
>        thisform.MakeLenta("SQRT")
>        thisform.Result = SQRT(VAL(thisform.Enter.Value))
>        thisform.Enter.Value = ALLTRIM(STR(thisform.Result,19,2))
>        thisform.fl_znak = .f.
>        thisform.MakeLenta("T")
>    ENDPROC
>
>
>    PROCEDURE fillbutt.Click
>        IF .NOT. thisform.Blockade
>           thisform.MemoClick = .f.
>           IF EMPTY(thisform.Znak)
>              thisform.Result = VAL(thisform.Enter.Value)
>           ELSE
>              ThisForm.Calculate()
>           ENDIF
>           thisform.Znak = ""
>           thisform.fl_znak = .f.
>           asd     = ALLTRIM(STRTRAN(STR(thisform.Result,16,7),"0"," "))
>           m_point = AT(".",asd)
>           m_point = IIF(m_point=LEN(asd),0,LEN(asd)-m_point)
>           _CLIPTEXT = ALLTRIM(STR(thisform.Result,16,m_point))
>        ENDIF
>        thisform.Off.Click()
>    ENDPROC
>
>ENDDEFINE
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform