标签: numeric-input

在Ionic/Cordova应用程序上仅显示数字键盘

我的Ionic/Cordova应用程序有两个问题,都有数字键盘我无法显示它.

1)需要显示数字键盘的密码输入.它显示了一个字母数字键盘.如果我改为数字,我无法隐藏条目(带*).

2)我必须插入货币掩码的数字输入(从左到右).我找到的所有选项都在文本输入中运行.

有人帮帮我吗?请!

keyboard android cordova numeric-input ionic-framework

15
推荐指数
5
解决办法
2万
查看次数

闪亮的 numericInput() 不考虑最小值和最大值

在 Shiny 中,如果我有一个 numericInput 作为输入,当用户手动输入一个值时,它不会识别或尊重最大/最小值并允许任何数字。如果用户选择下拉列表的箭头,它会尊重这些值,但只是手动输入时不会。如何让手动输入遵守上/下限值?

numericInput("test", label=("TestLabel"), min=0, max=10, value="", step = 1.0),
Run Code Online (Sandbox Code Playgroud)

r shiny numeric-input

8
推荐指数
1
解决办法
3156
查看次数

比scanf更快?

我正在使用大量解析正整数scanf("%d", &someint).正如我想看看scanf是否是一个瓶颈,我实现了一个天真的整数解析函数fread,就像:

int result;
char c;

while (fread(&c, sizeof c, 1, stdin), c == ' ' || c == '\n')
    ;

result = c - '0';
while (fread(&c, sizeof c, 1, stdin), c >= '0' || c <= '9') {
     result *= 10;
     result += c - '0';
}

return result;
Run Code Online (Sandbox Code Playgroud)

但令我惊讶的是,这个功能的表现(即使内联)也差了不到50%.对于特殊情况,是否应该有可能改进scanf?不fread应该是快速的(附加提示:整数是(编辑:大多数)1或2位数?)?

c input scanf numeric-input

6
推荐指数
1
解决办法
5963
查看次数

如何格式化 Shiny 更新的 numericInput 的输入但不更改实际值?

在以下示例中,numberInput“编号 C”的计算和更新为“编号 A”除以“编号 B”。当结果是无限小数时,这会导致一个数字很多的数字为“数字 C”。我想将无限小数四舍五入到数字的第二个或第三个,使“数字 C”的外观更易于阅读。但是,与此同时,我不想应用该round函数,num_C因为在现实世界中,我想将“数字 C”应用于其他计算,并且我想按原样使用该数字。换句话说,我想找到一种方法来格式化数字的外观而不是实际值,例如格式化 Excel 电子表格中的单元格以仅显示有限的数字但不更改实际值。这可以在 Shiny 中做到吗?

library(shiny)

# Define UI
ui <- fluidPage(
  numericInput(inputId = "A", "Number A", value = 2),
  numericInput(inputId = "B", "Number B", value = 3),
  numericInput(inputId = "C", "Number C [A/B]", value = 1)
)

# Server logic
server <- function(input, output, session){

  observe({
    req(input$A, input$B)
    num_C <- input$A/input$B
    updateNumericInput(
      inputId = "C",
      session = session,
      value = num_C
    )
  })
}

# Complete app …
Run Code Online (Sandbox Code Playgroud)

javascript format r shiny numeric-input

5
推荐指数
1
解决办法
2433
查看次数

r闪亮防止在numericInput为空时使应用程序崩溃

我有一个非常简单的闪亮应用程序正在运行。用户在框1上输入一个值,然后在框2中输入一个值,然后单击“运行”。

但是,当用户在两个numericInput单元格之一中按退格键直到没有输入任何内容时,应用程序就会崩溃。

如何防止它崩溃?非常感谢你!

library(shiny)
library(shinyjs)

ui <- fluidPage(
  useShinyjs(),
  actionButton("run", label = "Run calculations!"),
  # Input 1
  numericInput("inNumber1", label = "Input number 1", 
               value = 100, min = 10, max = 200, step = 10),
  # Message that shows up if the value of inNumber1 is outside the allowed range:
  hidden(h5("Enter a value between 10 and 200!",
            id = "message1",
            style = "font-weight:bold;color:orange;")),

  uiOutput("inNumber2"),
  # Message that shows up if the value of inNumber1 is outside the allowed range:
  hidden(h5("Enter …
Run Code Online (Sandbox Code Playgroud)

r shiny numeric-input

0
推荐指数
1
解决办法
610
查看次数