PDA

View Full Version : cWebPanel focus



DaveR
23-Aug-2024, 05:20 PM
Trying to have the focus on the oPrivate form when the panel loads, but it never does. It's the only form on the panel so I'm sure I'm missing something huge...



Object oWebMainPanel is a cWebPanel
Set piColumnCount to 12
WebSetResponsive piColumnCount rmMobile to 6

Set pbServerOnShow to True


Procedure OnShow
Forward Send OnShow
Send Focus of oPrivate
End_Procedure



Object oPrivate is a cMyWebIntForm
Set piColumnIndex to 3
Set peDataType to typeNumber
Set piColumnSpan to 3
Set piPrecision to 0
Set piMaxLength to 5
Set pbServerOnBlur to True
Set pbAutoTab to True
Set pbPassword to True
Set psLabel to "Private Code"
Set peAlign to alignCenter

WebRegisterPath ntNavigateForward oRcptItems

Procedure Focus
Forward Send Focus
WebSet psValue to ""
End_Procedure

Procedure OnBlur
String sValue sRet
Handle hoNext
Forward Send OnBlur
WebGet psValue to sValue
If (sValue="") Procedure_Return 1
Get CheckPrivateCode sValue 30 to sRet
If (sRet<>"") Begin
Send UserError sRet
Procedure_Return 1
End
Send NavigateForward to oRcptItems Self

End_Procedure


End_Object



End_Object

André de Vries
26-Aug-2024, 03:53 AM
Do you have it within a cWebView?

DaveR
29-Aug-2024, 01:37 PM
Do you have it within a cWebView? Sorry for the delayed response, yes.



Object oRcptStart is a cWebView
Set psCaption to "POS New Receipt"
Set pbShowCaption to False
Set piMaxWidth to 1024
Set peViewType to vtZoom
Set psStateViewName to "start"

Set Verify_Save_msg to 0
Set pbFocusFirstOnShow to True //False

//would DDOs be here or somewhere globally? see foot of code




Object oWebMainPanel is a cWebPanel
Set peLayoutType to ltGrid
Set peRegion to prcenter

Set piColumnCount to 12
WebSetResponsive piColumnCount rmMobile to 6

Set pbServerOnShow to True

Procedure OnLoad
Forward Send OnLoad
Send Activate of oPrivate
// Send OnFocus of oPrivate
End_Procedure

Object cGroup1 is a cWebGroup
Set piColumnCount to 12
Set piColumnSpan to 12
WebSetResponsive piColumnCount rmMobile to 6
Set peLayoutType to ltInherit
Set piRowCount to 6

Procedure OnShow
Forward Send OnShow
Send OnFocus of oPrivate
End_Procedure



Object oPrivate is a cWebForm //how do I get the focus here, or do I want to?
Set piColumnIndex to 3
Set peDataType to typeNumber
Set piColumnSpan to 3
Set piPrecision to 0
Set piMaxLength to 5
Set pbServerOnBlur to True
Set pbAutoTab to True
Set pbPassword to True
Set psLabel to "Private Code"
Set peAlign to alignCenter
//Set psPlaceHolder to "Private code" // does play well with masked form? doesnt work, anyway

WebRegisterPath ntNavigateForward oRcptItems

Procedure OnFocus
WebSet psValue to ""
Set psBackgroundColor to clGreen
Forward Send OnFocus

End_Procedure

Procedure OnBlur
String sValue sRet
Handle hoNext
Forward Send OnBlur
WebGet psValue to sValue
If (sValue="") Procedure_Return 1
Get CheckPrivateCode sValue 30 to sRet
If (sRet<>"") Begin
Send UserError sRet
Procedure_Return 1
End
Set Color to clAqua
Send NavigateForward to oRcptItems Self

End_Procedure

End_Object

DaveR
29-Aug-2024, 03:40 PM
Do you have it within a cWebView?

Funnily enough it works when that .wo is called from a 'standard' Dashboard.wo, and since posting the original query I'm going that direction now.

JeffKimmel
29-Aug-2024, 06:26 PM
Dave,

Are you sure the onShow is getting called? Not sure if this is the issue but onShow is a cWebView method so I'm not sure that code gets hit in a cWebGroup. If you try moving it to the webView it might work.

Jeff

DaveR
30-Aug-2024, 07:39 AM
Dave,

Are you sure the onShow is getting called? Not sure if this is the issue but onShow is a cWebView method so I'm not sure that code gets hit in a cWebGroup. If you try moving it to the webView it might work.

Jeff

The group is a late addition so maybe you're right. Thanks.