FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour REDEFINE GET MEMO y cláusula ACTION
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
REDEFINE GET MEMO y cláusula ACTION
Posted: Sat Oct 17, 2020 08:58 AM
Hola,

Espero que estéis todos bien. En un campo GET desde recursos tipo memo, es decir, REDEFINE GET cCampoMemo, necesito también poder usar la cláusula ACTION, que en los gets normales sí es posible, pero no en los memos.

Es decir:

Code (fw): Select all Collapse
REDEFINE GET cCampoMEMO ID 101 OF oDlg MEMO ACTION Mifuncion()


¿Hay alguna forma de conseguirlo?

Gracias.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Sat Oct 17, 2020 09:20 AM

Jose Luis,

La claúsula GET ... ACTION ... muestra un botón en el GET

Deseas que se vea ese botón en el GET multilinea (Memo) ? En que posición ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Sat Oct 17, 2020 09:33 AM

Así es.

El botón debería ir en la primera línea, en el borde derecho del campo, como en el GET ACTION normal por favor.

¡Muchas gracias!

Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Wed Dec 23, 2020 11:48 AM

Hola amigos,

¿Hay algún avance?

Gracias. Un saludo y feliz navidad

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Wed Dec 23, 2020 12:50 PM
Jose Luis,

Aqui tienes un ejemplo:
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDlg, cText, oMemo

   DEFINE DIALOG oDlg SIZE 400, 200

   @ 1, 2 GET oMemo VAR cText MEMO OF oDlg SIZE 150, 40
 
   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( BuildButton( oMemo ), .T. )

return nil

function BuildButton( oMemo )

   local oBtn

   @ oMemo:nTop, oMemo:nRight * 2 + 2 BUTTON oBtn PROMPT "..." OF oMemo:oWnd PIXEL SIZE 20, 20 ACTION MsgInfo( "click" ) 

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Wed Dec 23, 2020 09:07 PM

Muchas gracias Antonio, pero no me acaba de valer, porque el botón tiene que estar dentro del campo mismo, como ocurre con los GET normales, para que todo sea simétrico. Y además lo uso desde recursos.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Thu Dec 24, 2020 09:26 AM
Aqui lo tienes :-)

Con recursos solo tienes que cambiar @ 1, 2 GET ... por REDEFINE GET ...
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDlg, cText, oMemo

   DEFINE DIALOG oDlg SIZE 400, 200

   @ 1, 2 GET oMemo VAR cText MEMO OF oDlg SIZE 150, 40
 
   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( BuildButton( oMemo ), .T. )

return nil

function BuildButton( oMemo )

   local oBtn

   @ 0, oMemo:nWidth - 42 BUTTON oBtn PROMPT "..." OF oMemo PIXEL SIZE 20, 20 ACTION MsgInfo( "click" )
   
   oMemo:bChange = { || oBtn:Refresh() }

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Thu Dec 24, 2020 11:33 AM

Muchas gracias Antonio.

Pero el comportamiento sigue sin ser como REDEFINE GET ACTION, ya que en este caso el botón se sitúa dentro del get, no fuera, y no se puede escribir texto sobre el botón.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Thu Dec 24, 2020 12:16 PM
Jose Luis,

El código último al ejecutarse aqui se ve asi:

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Thu Dec 24, 2020 12:23 PM
Antonio,

Mira esto por favor:

Code (fw): Select all Collapse
#Include "FiveWin.ch"

//----------------------------------------------------------------------------//

Function Main()

   Local oDlg
   local oMemo
   local cGet := space(100)





   DEFINE DIALOG oDlg NAME "Test" TITLE "Prueba memo"



          REDEFINE GET oMemo VAR cGet  OF oDlg  ID 100  MEMO


   REDEFINE BUTTON ID 110 ACTION ( oDlg:end() )

   REDEFINE BUTTON ID 120  ACTION ( oDlg:end() )




   ACTIVATE DIALOG oDlg CENTERED;
            ON INIT ( BuildButton( oMemo ), .T. )





Return nil



function BuildButton( oMemo, oDlg )

   local oBtn


   @ 0, oMemo:nWidth - 22 BUTTONBMP oBtn PROMPT "..." OF oMemo PIXEL SIZE 20, 20 ACTION MsgInfo( "click" )

   oMemo:bChange = { || oBtn:Refresh() }



return nil



archivo .rc

Code (fw): Select all Collapse
#ifdef __FLAT__
  1 24 "c:\fivetech\WindowsXP.Manifest"
#endif


#define IDC_EDIT1   101

Test DIALOG 41, 64, 409, 199
EXSTYLE WS_EX_DLGMODALFRAME
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing"
FONT 8, "MS Sans Serif"
{
 
 EDITTEXT 100, 6, 12, 166, 162, ES_AUTOHSCROLL | ES_MULTILINE | WS_BORDER | WS_TABSTOP
 CONTROL "OK", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 179, 50, 16
 CONTROL "Cancelar", 120, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 95, 179, 50, 16
}



Muchas gracias.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: REDEFINE GET MEMO y cláusula ACTION
Posted: Thu Dec 24, 2020 12:49 PM

Jose Luis,

No es simple modificar el comportamiento de un control estandar de Windows.

Ahora hay que ver como hacer que el texto no ocupe el área del botón...

A buscar en google para ver si se puede hacer y como :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion