Skip to main content

Float Edit

Overview

Float Edit is to receive user input, mainly for processing and receiving numeric types. Especially when dealing with floating point numbers, the Float Edit will not receive input other than numbers.

Focus can be got by clicking the Edit Box and there will be a cursor flashing in the Edit Bar at this time. The Edit Box can only get user input after getting the focus. Clicking other areas outside the Edit Box will make it fail to obtain user input because of losing focus.

  • Get Focus

  • Lost Focus

Properties

PropertyDescription
TextThe current content displayed in the Edit Box.
Font ColorDisplay the font color of the control.
Hint TextHint text appears when the mouse hovers over the control.
FormatSet the precision of the floating point number.

Events

Callback NameCallback Function
on_get_focusGet focus callback by mouse clicks.
on_lost_focusLost mouse click focus callback.
on_changedThe callback called when the input content is changed.
on_enterThe callback called when the Enter key is hit.

Lua Script Example

self.Text = "Edit"
self.Format = "%.5f"

function on_float_edit_enter(self)
local str=nx_string(self.Text)
nx_msgbox(str)
end