Skip to content

Commit

Permalink
Merge pull request IDEMSInternational#9178 from Fidel365/fnctns_keyboard
Browse files Browse the repository at this point in the history
Adding four new keys to functions keyboard
  • Loading branch information
N-thony authored Oct 16, 2024
2 parents d757162 + b91fb75 commit eb578e0
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 12 deletions.
6 changes: 6 additions & 0 deletions instat/static/InstatObject/R/stand_alone_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -3409,3 +3409,9 @@ check_github_repo <- function(owner = NULL, repo = NULL, url = NULL) {
})
}
}
#Convert Decimal to Fractions
frac10 <- function(x) {paste0(round(x * 10), "/", 10)} #Give fraction our of 10 for a decimal value
frac20 <- function(x) {paste0(round(x * 20), "/", 20)} #Give fraction our of 20 for a decimal value
frac100 <- function(x) {paste0(round(x * 100), "/", 100)} # Give fraction our of 100 for a decimal value

frac_den <- function(x, den) {paste0(round(x * den), "/", den)} # Give fraction for a given denominator
78 changes: 67 additions & 11 deletions instat/ucrCalculator.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 37 additions & 1 deletion instat/ucrCalculator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ Public Class ucrCalculator
ttCalculator.SetToolTip(cmdPascal, "Gives Pascal triangles, e.g. for c(1,2,3,4) gives 1, (1,1), (1, 2, 1), (1, 3, 3, 1)")
ttCalculator.SetToolTip(cmdMASSFractions, "changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.")
ttCalculator.SetToolTip(cmdDecimals, "the inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.")
ttCalculator.SetToolTip(cmdFrac10, "Give fraction our of 10 for a decimal value. For example for 0.36 the value is 4/10")
ttCalculator.SetToolTip(cmdFrac20, "Give fraction our of 20 for a decimal value. For example for 0.36 the value is 7/20")
ttCalculator.SetToolTip(cmdFrac100, "Give fraction our of 100 for a decimal value. For example for 0.36 the value is 36/100")
ttCalculator.SetToolTip(cmdFracDen, "Give fraction for a given denominator. For example frac_den(0.36, 50) gives 18/50")
'---------------------------------------------------------------------------------------------------------------------

Const strTooltipCmdLength = "number Of observations: For example length(c(1,2,3,4,NA)) = 5 "
Expand Down Expand Up @@ -5893,7 +5897,7 @@ Public Class ucrCalculator

Private Sub cmdOrigin_Click(sender As Object, e As EventArgs) Handles cmdOrigin.Click
If chkShowParameters.Checked Then
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("polynom::change.origin( p= ,o= )", 6)
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("polynom::change.origin(p= ,o= )", 6)
Else
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("polynom::change.origin(, )", 3)
End If
Expand Down Expand Up @@ -6097,4 +6101,36 @@ Public Class ucrCalculator
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("decimals( )", 2)
End If
End Sub

Private Sub cmdFrac10_Click(sender As Object, e As EventArgs) Handles cmdFrac10.Click
If chkShowParameters.Checked Then
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac10(x= )", 2)
Else
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac10( )", 2)
End If
End Sub

Private Sub cmdFrac20_Click(sender As Object, e As EventArgs) Handles cmdFrac20.Click
If chkShowParameters.Checked Then
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac20(x= )", 2)
Else
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac20( )", 2)
End If
End Sub

Private Sub cmdFrac100_Click(sender As Object, e As EventArgs) Handles cmdFrac100.Click
If chkShowParameters.Checked Then
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac100(x= )", 2)
Else
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac100( )", 2)
End If
End Sub

Private Sub cmdFracDen_Click(sender As Object, e As EventArgs) Handles cmdFracDen.Click
If chkShowParameters.Checked Then
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac_den(x= ,den= )", 8)
Else
ucrReceiverForCalculation.AddToReceiverAtCursorPosition("frac_den(, )", 3)
End If
End Sub
End Class

0 comments on commit eb578e0

Please sign in to comment.