Beijer Electronics (formerly QSI Corporation)
http://www.qsiforums.com/

PopupScreen with Edit Box, NumberKeypad
http://www.qsiforums.com/viewtopic.php?f=6&t=4469
Page 1 of 1

Author:  kkwon [ Tue Jun 26, 2012 9:37 am ]
Post subject:  PopupScreen with Edit Box, NumberKeypad

Hi,
Using a popup screen with edit box a numberkeypad for user entry. The pop up screen will be invoked via press of an EZCircle object. Problem I am having is that the numberkeypad will not pop up. Below is the code:

EZCircle object:
func handlepress()

' handle the set scope button press
PopupScreen_SetScope.enabled = true
EditBox_SetScope.enabled = true
endfunc

PopupscreenV2 object: PopupScreen_SetScope

init parent := default
init xpos := 197
init ypos := 318
init width := 340
init height := 170
init value := "Enter Target Scope"
init enterbutton := true
init enabled := false


func EnterButtonPressed() returns boolean

PopupScreen_SetScope.enabled = false

return true
endfunc


func CancelButtonPressed() returns boolean
PopupScreen_SetScope.enabled = false

return true
endfunc


EditBoxV2 object: EditBox_SetScope

init parent := popupscreen_setscope
init xpos := 35
init ypos := 66
init width := 275
init height := 35
init boxtype := eb_singleline
'init autoEdit := true
init editType := eb_ReadWrite


func ScreenPress(xdown as integer, ydown as integer) returns boolean
handles MSG_SCREEN_PRESS

if (_kt_focusObj <> me) then
_KeySetFocus(me, false)
endif

return true
endfunc

func focusOn()

NumberKeypad_1.value = 0.0
NumberKeypad_1.enabled = true

endfunc

func focusOff()

NumberKeypad_1.enabled = false

endfunc

NumberKeyPadV2 object: NumberKeypad_1:

init parent := default
init popupStyle := _NKP_StdPopup
init autohide := false
init ClickOnPress := true
init AutoClear := true
init HasBackBtn := true
init HasCancel := true
init HasDecimal := true
init HasEnter := true
init HasPlusMinus := true
init HasValueBox := true
init PasswordMode := false
init enabled := false
init xpos := 247
init ypos := 191
init width := 442
init height := 221


func EnterPressed()

' handle new target scope entry
if (NumberKeypad_1.value >= float(SysParamsIntegers[I_MIN_DPLY_LENGTH]) and ->
NumberKeypad_1.value <= float(SysParamsIntegers[I_MAX_DPLY_LENGTH])) then
' set the new target scope
val(fTargetScope, EditBox_SetScope.Value)

' send a message to globals
' man, silly thing don't like it if a handler in specific object is used.
' may have to extract the object template and add the handler there.
UserDirectMsg(default, SCOPE_ENTERED_MSG, 0, false)
else
' set to invalid value
fTargetScope = float(SysParamsIntegers[I_MIN_DPLY_LENGTH]) - 1.0
EditBox_Message.value = "Value Entered Out of Range"
PopupScreen_Message.enabled = true
endif

NumberKeypad_1.enabled = false

endfunc

func CancelPressed()

NumberKeypad_1.value = 0.0
NumberKeypad_1.enabled = false

endfunc

Any suggestions why the NumberKeypad won't popup?

---

Ken

Author:  Ron L. [ Tue Jun 26, 2012 9:50 am ]
Post subject:  Re: PopupScreen with Edit Box, NumberKeypad

When do you want the NumberKeypad to appear? When the popup screen appears or when the edit box is pressed?

To show a numberKeypad the code looks like:

Code:
numberkeypad_1.enabled = true
SendToFront(numberkeypad_1)

Author:  kkwon [ Tue Jun 26, 2012 12:02 pm ]
Post subject:  Re: PopupScreen with Edit Box, NumberKeypad

Hi Ron,
Would like the NumberKeypad to pop up when the edit box is touched.

Thanks,
Ken

Author:  Ron L. [ Tue Jun 26, 2012 12:43 pm ]
Post subject:  Re: PopupScreen with Edit Box, NumberKeypad

You could put some code similar to this in your EditBox instance.

Code:
init parent := default
init xpos := 140
init ypos := 70
init width := 180
init height := 80
init boxtype := eb_multilinescroll

func ScreenRelease (xup as integer, yup as integer) returns boolean
    handles MSG_SCREEN_RELEASE
    numberkeypad_1.enabled = true
    SendToFront(numberkeypad_1)
    return default (xup, yup)
endfunc

Author:  Ron L. [ Tue Jun 26, 2012 12:44 pm ]
Post subject:  Re: PopupScreen with Edit Box, NumberKeypad

You could also put a transparent button in front of the edit box and use it's click event.

Code:
init value := "button_1"
init parent := default
init xpos := 150
init ypos := 80
init width := 170
init height := 60
init transparent := true

func click()
    numberkeypad_1.enabled = true
    SendToFront(numberkeypad_1)
endfunc

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/