Page 1 of 1

Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Mon Mar 25, 2024 10:50 am
by FiveWiDi
Hola a todos,

Veo que en la lógica del control TEDIT está este código:

::nStyle = nOr( ::nStyle, ES_READONLY )

¿Cómo se puede revertir este código en tiempo de ejecución y si es necesario volverlo a aplicar?

Muchas gracias,

Re: Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Mon Mar 25, 2024 11:26 am
by Antonio Linares
Carlos,

Prueba con:

oEdit:WinStyle( ES_READONLY, .F. ) // ó .T. si necesitas volver a aplicarlo

Re: Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Mon Mar 25, 2024 1:57 pm
by FiveWiDi
Antonio Linares wrote:Carlos,

Prueba con:

oEdit:WinStyle( ES_READONLY, .F. ) // ó .T. si necesitas volver a aplicarlo


Gracias Antonio,

Pero no ha funcionado, permitía editar el texto tanto con .F. como con .T.; le he aplicado:

oEdit:WinStyle( 2048 /* ES_READONLY */ , .F. )

2048 lo he encontrado en winapi.ch

A ver si se te ocurre algo.
Es un control que me muestra un texto que según que condiciones debe permitir editarlo o no.

Muchas gracias,

Re: Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Mon Mar 25, 2024 2:37 pm
by karinha
Carlos, ¿es posible publicar un ejemplo completo para probar, por favor?

Gracias.

Regards, saludos.

Re: Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Mon Mar 25, 2024 5:21 pm
by nageswaragunupudi
Code: Select all  Expand view

#define EM_SETREADONLY          0x00CF

//
//

     If( oEdit:WinStyle( ES_READONLY ), oEdit:SendMsg( EM_SETREADONLY, 0 ), ;
         oEdit:SendMsg( EM_SETREADONLY, 1 ) ) }
 

Re: Como revertir ::nStyle = nOr( ::nStyle, ES_READONLY )

PostPosted: Tue Mar 26, 2024 4:43 am
by nageswaragunupudi
You can use the above code to Toggle ReadOnly status during runtime. This code is tested.

From the next version, we have provided DATA lReadOnly. We can toggle this at runtime with oEdit:lReadOnly := .T. or .F..