Switch focus on tab press
-
It's a touch screen program, but the customer wants to use an external keyboard. Please advise on the best method to handle it while pressing the tab key. focus should also change
-
It's a touch screen program, but the customer wants to use an external keyboard. Please advise on the best method to handle it while pressing the tab key. focus should also change
@Gaurav-Agshift said in Switch focus on tab press:
Please advise on the best method to handle it while pressing the tab key. focus should also change
That should work out of the box. What exactly is the problem?
-
@Gaurav-Agshift said in Switch focus on tab press:
Please advise on the best method to handle it while pressing the tab key. focus should also change
That should work out of the box. What exactly is the problem?
@jsulmWhen I hit the tab, the focus does not change from one input field to another, and we must instead manually click on the desired field to set it as the focus. However, the user claims they do not want to touch the touchscreen keypad and instead only want to utilise external keypads. when user press enter key or tab so easily focus should change.in below code what to change from gross weight to tare weight after clicking the tab or enter.
AgShiftNameValue {
id: dlvyGrossContainer
objectName: "dlvyGrossContainer"itemHeight: getItemHeight() name: qsTr("Dlvy Gross wt") isEnabled: isCheckerboardValid() valueType: "Float" placeValue: "Tap & Enter" value: root.inspectionGrossWeight valueState: root.inspectionGrossWeight ? "Selected" : "Empty" clickPopup: numericKeypad keypadAlignment: TextInput.AlignTop mandatory: (root.inspectionGrossWeight == "") ? true : false visible: !showVarietyWeightPanel() && isWeightVisible() styleSheet: valuesModel._styleSheet sectionConfig: valuesModel.sectionConfig function isWeightVisible() { var m = JSON.parse(Settings.commodities) return root.commodity && root.commodity.length && m[root.commodity.toLowerCase()]["measuredByWeight"] && !(Session.inspection_type === "training") } function initialize() { valueState = root.inspectionGrossWeight ? "Selected" : "Empty" } onValueChanged:{ console.debug(logObj.pageAction,Settings.GROSS_WEIGHT_MAX_THRESHOLD +" dekho kya aaya hai") if (Number(root.inspectionGrossWeight) >= Settings.GROSS_WEIGHT_MAX_THRESHOLD || Number(root.inspectionGrossWeight) < Settings.GROSS_WEIGHT_MIN_THRESHOLD) { notifygrossText.show("Dlvy Gross wt should be greater than or equal to 1 and less than "+ Settings.GROSS_WEIGHT_MAX_THRESHOLD) } else { notifygrossText.hide() } if(!isEmptyVal(root.inspectionGrossWeight) && root.inspectionTareWeight !== 0){ (Number(root.inspectionTareWeight) >= Number(root.inspectionGrossWeight)) ? notifytareText.show("Dlvy Tare wt should be less than Dlvy Gross weight") : notifytareText.hide() } } onSelectionChanged: { root.inspectionGrossWeight = newItem } } Text { id: notifytareText visible: false width: 300 leftPadding: 20 anchors.top: dlvyTareContainer.bottom anchors.horizontalCenter: parent.horizontalCenter color: "black" font.pointSize: 12 font.family: "Ubuntu" function show(message) { text = message visible = true } function hide() { visible = false text = "" } } AgShiftNameValue { id: dlvyTareContainer objectName: "dlvyTareContainer" itemHeight: getItemHeight() name: qsTr("Dlvy Tare wt") isEnabled: isCheckerboardValid() valueType: "Float" placeValue: "Tap & Enter" value: root.inspectionTareWeight // ? root.inspectionTareWeight : "0" valueState: root.inspectionTareWeight ? "Selected" : "Empty" clickPopup: numericKeypad keypadAlignment: TextInput.AlignTop mandatory: initialize() visible: !showVarietyWeightPanel() && isWeightVisible() styleSheet: valuesModel._styleSheet sectionConfig: valuesModel.sectionConfig function isWeightVisible() { var m = JSON.parse(Settings.commodities) return root.commodity && root.commodity.length && m[root.commodity.toLowerCase()]["measuredByWeight"] && !(Session.inspection_type === "training") } function initialize() { valueState = root.inspectionTareWeight ? "Selected" : "Empty" return (valueState == "Empty") ? true : false } onSelectionChanged: { root.inspectionTareWeight = newItem } onValueChanged: { if(!isEmptyVal(root.inspectionGrossWeight)){ (Number(root.inspectionTareWeight) >= Number(root.inspectionGrossWeight)) ? notifytareText.show("Dlvy Tare wt should be less than Dlvy Gross weight") : notifytareText.hide() } } }