Página 1 de 1

Problemas Utlizando Sidenav

Publicado: Vie Jun 20, 2025 10:09 pm
por michaelp
Buenas Tardes :


Estoy realizando un pequeño proyecto Utilizando Sidenav

Todo va relativamente bien pero cuando le agregue un login Y tengo estos problemas.
//:cMethod := "post" // lINEA Error
WITH OBJECT WButton():New(oGrupo) // Basta que lo active no levanta la pagina

De paso otra consulta hay alguna propiedad para mantener el Sidenav siempre desplegado?

Adjunto el Codigo Completo para la evaluacion

Agradesco el apoyo


#include "xa-materialize.ch"
#include "xaWeb.ch"
CLASS WDocMain FROM WDoc

DATA cUser INIT "" PERSISTENT
DATA cNombre INIT "" PERSISTENT
METHOD CreateDoc()
METHOD MostrarLogin()
METHOD ValidarLogin(cUser, cClave)
END CLASS


METHOD CreateDoc() CLASS WDocMain
LOCAL oContainer, oSidenav, oBtn
LOCAL cJs,cHtmlRef:="",cHtml:=""
// Crear contexto Materialize
WMaterializeContext():New(Self)
// Agregar switch de tema oscuro/claro
WITH OBJECT WLink():New(Self)
:cId := "theme-switch"
:Create()
WITH OBJECT WIconGoogle():New(SO)
:cText := "dark_mode"
END WITH
END WITH
// Contenedor principal
WITH OBJECT oContainer := WMain():New(Self)
:AddClass("container")
// Título
WITH OBJECT WText():New(SO)
:cText := "<h3>Menú con Materialize</h3>"
:Create()
END WITH

** Crear estructura principal
WITH OBJECT oContainer := WMain():New(Self)
:AddClass("container")
// Barra lateral
WITH OBJECT oSidenav := WSidenav():New(SO)
:cId := "sidenav"
:nOutDuration := 100
// Cabecera con imagen y datos
WITH OBJECT :AddHeader( "https://materializeweb.com/images/office.jpg" )
:AddImage( "https://materializeweb.com/images/yuna.jpg" )
:AddItem( "John Doe" ):AddClass( "white-text name" )
:AddItem( "jdoe@example.com" ):AddClass( "white-text email" )
END WITH

:AddItem("Ingresar ",::Action( "Mostrarlogin" ),"folder")
//:lCloseNav := .t. // Cerrar menú al seleccionar
END WITH
// Botón para mostrar el menú
oBtn := oSidenav:SlideButton(SO, "Mostrar Menú")
//oSidenav:(SO)

WITH OBJECT WSpan():New(SO)
:cId := "result"
:AddClass("card-panel")
:oStyle:Min_height := "50px"
:oStyle:Display := "none"
:Create()
END WITH
WITH OBJECT WParagraph():New( Self )
:cText := cHtml
:Create()
END WITH

END WITH


END WITH

RETURN nil



METHOD ValidarLogin(cUser, cClave) CLASS WDocMain
if cUser="100000001" .and. cClave ="100000"
::cUser := "100000001"
::cNombre := "Mi Nombre "
endif

RETURN NIL

METHOD CerrarSesion() CLASS WDocMain
::cUser := ""
::cNombre := ""
::cTipo := ""
::cDni := ""

WITH OBJECT WText():New(Self)
:cText := "<h3>Cerrando Sesion </h3>"
:Create()
END WITH

RETURN NIL



METHOD MostrarLogin() CLASS WDocMain
LOCAL oGroup,oGrupo


WITH OBJECT oGrupo:=WMain():New(Self)
:AddClass("container")

WText():New(SO):cText := "<h4>Ingrese sus credenciales</h4>"

WITH OBJECT oGroup := WFieldset():New( oGrupo )

:cLegend := "Credenciales de ingreso"
:cName := "Frm_CheckLogin"
:AddStyle( "width: 400px" )
:Create()

WITH OBJECT WEdit():New( oGroup )

:cLabel := "Usuario:"
:lLabelNewLine := .t.
:cId := "user"
:cName := "user"
:cPlaceHolder := "Codigo Usuario"
:nSize := 50
:nMaxLength := 50
:nMinLength := 5
:Create()
END WITH
WITH OBJECT WEdit():New( oGroup )
:cLabel := "Password:"
:lLabelNewLine := .t.
:cType := "password"
:cId := "clave"
:cName := "clave"
:cPlaceHolder := "Clave"
:nSize := 50
:nMaxLength := 50
:nMinLength := 4
:Create()
END WITH

END WITH
/*
WITH OBJECT WButton():New(oGrupo) // Basta que lo active no levanta la pagina
:cText := "Validar"
:cType := "button"
:cId := "btnValidar"
:Create()
END WITH
*/
END WITH


RETURN NIL

*
Esto es si Activo :cMethod := "post"
ERROR: Message not found / WEDIT:_CMETHOD - BASE [1005]

Called from:
 __ERRRT_SBASE(0)
 WEDIT:ERROR(0)
 (b)HBOBJECT(0)
 WEDIT:MSGNOTFOUND(0)
 WEDIT:_CMETHOD(0)
 WDOCMAIN:MOSTRARLOGIN(118)
 __OBJSENDMSG(0)
 WDOCMAIN:RUNMETHOD(253)
 WROUTER:RUNDOC(172)
 WROUTER:START(52)
 MAIN(13)


Y este es el error cuando activo el boton WITH OBJECT WButton():New(oGrupo)
Probe con WITH OBJECT WButton():New(SO)
Probe con WITH OBJECT WButton():New(Self)
Probe con WITH OBJECT WButton():New(oGroup)

xaWeb error (1.0.0)
ERROR : Message not found / WBUTTON:_CDISPLAYTYPE - BASE [1005]

Called from:
 __ERRRT_SBASE(0)
 WBUTTON:ERROR(0)
 (b)HBOBJECT(0)
 WBUTTON:MSGNOTFOUND(0)
 WBUTTON:_CDISPLAYTYPE(0)
 WSIDENAV:SLIDEBUTTON(151)
 WDOCMAIN:CREATEDOC(54)
 WDOCMAIN:START(220)
 WROUTER:RUNDOC(170)
 WROUTER:START(47)
 MAIN(13)

Re: Problemas Utlizando Sidenav

Publicado: Dom Jun 22, 2025 4:41 am
por michaelp
Solucionado estudiando los ejemplos

Re: Problemas Utlizando Sidenav

Publicado: Lun Jun 23, 2025 9:52 am
por ignacio
#include "xa-materialize.ch"
#include "xaWeb.ch"
Innecesaria la segunda línea
ERROR: Message not found / WEDIT:_CMETHOD - BASE [1005]
Called from:
 WEDIT:MSGNOTFOUND(0)
 WEDIT:_CMETHOD(0)
WDOCMAIN:MOSTRARLOGIN(118)
El control WEdit no tiene una propiedad 'cMethod'. Me he molestado en mover todo su mensaje a un editor y comprobar si hay alguna asignación de 'cMethod' en su método MostrarLogin y no hay ni una sola referencia. Obviamente el código que ha dado no es el que ha provocado el error.

En cualquier caso, le sugiero que simplemente haga lo mismo que yo: observe el error y saque conclusiones sencillas y fáciles. Un control WEdit está intentando acceder a una propiedad de nombre 'cMethod'. ¿Qué es lo primero que hay que hacer?

1) Comprobar si el control WEdit posee esa propiedad
2) Comprobar si realmente no quería utilizar esa propiedad con un control del tipo WEdit. Es decir: Se he equivocado de objeto.

ERROR : Message not found / WBUTTON:_CDISPLAYTYPE - BASE [1005]
Con total seguridad está enlazando xaWeb.lib antes de xaMaterialize.lib.

Le sugiero eche un vistazo a la guía de programación de xaWeb:
2025-06-23 09 50 50.png
2025-06-23 09 50 50.png (17.4 KiB) Visto 158 veces
Un saludo