get no disable y tampoco editable

get no disable y tampoco editable

Postby goosfancito » Thu May 06, 2021 9:51 am

Hola.

Necesito que un get solo muestre el contenido (muestra un "memo") y no quiero que pueda ser editable, pero no quiero desactivarlo porque no me deja ver todo el contenido (no se puede usar el scroll). Como lo hago?
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: get no disable y tampoco editable

Postby Antonio Linares » Thu May 06, 2021 10:06 am

Gustavo,

@ nRow, nCol GET ... MEMO READONLY

or

REDEFINE GET ... MEMO READONLY
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: get no disable y tampoco editable

Postby goosfancito » Fri May 07, 2021 9:24 am

Mira lo que pasa y al usar el SCROLL va mostrado la misma linea siempre.

https://ibb.co/NSFZN39

y esto es con READONLY

https://ibb.co/jDc3jfh
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: get no disable y tampoco editable

Postby karinha » Fri May 07, 2021 11:51 am

// Siempre ponga el código y el .RC para testes, porfa.

// \SAMPLES\SAMPLES.PRG

Code: Select all  Expand view

/*
viewtopic.php?f=3&t=33496&p=197679#p197636

G. N. Rao.
Hyderabad, India

nageswaragunupudi
*/


#include "fivewin.ch"

REQUEST DBFCDX

static nLastTopic := 33507  // rage of topics
static nFirstopic := 33400

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

function Main()

   SET DATE BRITISH
   SET CENTURY ON
   SET DELETED ON
   RDDSETDEFAULT( "DBFCDX" )

   DBCREATE( "SAMPLES.DBF", { ;
      { "TOPICNO",   'N',  6, 0 }, ;
      { "TOPIC",     'C', 60, 0 }, ;
      { "AUTHOR",    'C', 40, 0 }, ;
      { "DATE",      'D',  8, 0 }, ;
      { "CODE",      'M', 10, 0 }  }, ;
      "DBFCDX", .T., "DB" )

   FW_CdxCreate()

   CLOSE DB

   USE SAMPLES EXCLUSIVE VIA "DBFCDX"

   ForumSamples( nLastTopic, nFirsTopic )

   BrowseSamples()

return nil

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

function BrowseSamples()

   local oDlg, oFont, oBold, oMono, oGet, oBrw

   SET ORDER TO TAG TOPICNO
   GO TOP

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-18 BOLD
   DEFINE FONT oMono NAME "Lucida Console" SIZE 0,-12

   DEFINE DIALOG oDlg SIZE 900,700 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "SAMPLES IN FWH FORUMS"

   @  90,20 XBROWSE oBrw SIZE 400,-20 PIXEL OF oDlg ;
      DATASOURCE "SAMPLES" ;
      COLUMNS "TOPICNO", "DATE", "AUTHOR" ;
      AUTOSORT ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nMarqueeStyle := MARQSTYLE_HIGHLROWRC
      :bChange       := { || oDlg:Update() }
      :lIncrFilter   := .t.
      :bSeek         := { |c| ( oBrw:cAlias )->( BrwFilter( c ) ) }
      :CreateFromCode()
   END

   @ 20, 20 SAY TRIM( SAMPLES->TOPIC ) SIZE 860,30 PIXEL OF oDlg CENTER ;
         FONT oBold UPDATE

   @ 60, 20 SAY "Filter containing all words any where" SIZE 300,20 PIXEL OF oDlg

   @ 60,340 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 540,20 PIXEL OF oDlg ;
      COLOR CLR_HRED,CLR_YELLOW

   @  90,420 SAY "CODE" SIZE 460,30 PIXEL OF oDlg CENTER ;
      COLOR CLR_BLACK, nRGB( 231, 242, 255 )

   @ 120,420 GET oGet VAR SAMPLES->CODE SIZE 460,540 PIXEL OF oDlg ;
      MEMO READONLY FONT oMono UPDATE

   oDlg:bPainted := { || oDlg:Box( 59,339,81,881 ) }

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont, oMono, oBold

return nil

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

function BrwFilter( c )

   local lFound   := .t.
   local aTokens
   local cSaveFilter := DBFILTER()
   local nSaveRec    := RECNO()
   local cFilter     := {}

   if Empty( c )
      return .t.
   endif

   c  := UPPER( c )
   aTokens  := HB_ATokens( c )

   for each c in aTokens
      AAdd( cFilter, "'" + c + "' $ UPPER( DBRECORDINFO( 9 ) )" )
   next

   cFilter  := FW_ArrayAsList( cFilter, " .AND. " )

   SET FILTER TO &cFilter
   GO TOP
   lFound   := ( OrdKeyCount() > 0 )

return lFound

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

function ForumSamples( nTopic, nLast )

   local cTopic, cUrl, cPageURL, cUser, cText, cCode, nPage, nPages, n, cLeft, dDate

   DEFAULT nTopic   := 33507, nLast := nTopic - 50

   for nTopic := nTopic to nLast step -1

      nPage    := 1
      cUrl  := TopicNoToURL( nTopic )
      do while .t.
         cPageURL := cUrl + If( nPage > 1, "&start=" + LTrim( Str( nPage * 15 ) ), "" )
         MsgRun( cPageURL, "READING FORUM PAGE", { || ;
            cText := WebPageContents( cPageUrl, .t. ) ;
            } )

         if nPage == 1
            nPages   := PageCount( cText )
            cTopic   := textbetween( ctext, "<h2>", "</h2>", 1 )
            cTopic   := textbetween( cTopic, ">", "</a>", 1 )
         endif

         n     := 1
         do while !Empty( cCode := TextBetween( cText, "<code>", "</code>", n, @cLeft ) )
            cUser := GetUserName( cLeft, @dDate )
            if Empty( dDate )
               dDate := CTOD( "" )
            endif
            cCode          := ExtractPrgCode( cCode )
            //
            DBAPPEND()
            FIELD->TOPICNO := nTopic
            FIELD->TOPIC   := cTopic
            FIELD->AUTHOR  := cUser
            FIELD->DATE    := dDate
            FIELD->CODE    := cCode
            n++

            SYSREFRESH()

         enddo
         nPage++
         if nPage > nPages
            EXIT
         endif

         SYSREFRESH()

      enddo
   next nTopic

return nil

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

function TopicNoToURL( nTopic )
return   "http://forums.fivetechsupport.com/viewtopic.php?f=3&t=" + cValToChar( nTopic )

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

function TextBetween( cText, cStartTag, cCloseTag, nPos, cLeft, cRight )

   local cRet  := ""

   if !( cStartTag $ cText )
      cLeft    := cText
      cRight   := ""
      return ""
   endif

   cRight   := AfterAtNum( cStartTag, cText,  nPos )
   cRet     := BeforAtNum( cCloseTag, cRight, 1    )

   if PCount() > 4
      cLeft    := BeforAtNum( cStartTag, cText,  nPos )
      cRight   := AfterAtNum( cCloseTag, cRight, 1    )
   endif

return cRet

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

function ExtractPrgCode( cCode )

   local nFrom, nUpto, cLeft, cRight, cToken
   local nFor
   local aSubs := { ;
      { '<br />',CRLF }, ;
      { '&nbsp;'," " }, ;
      { 'ÿ'," " }, ;
      { '&quot;','"' } }

   for nFor := 1 to Len( aSubs )
      cCode    := StrTran( cCode, aSubs[ nFor, 1 ], aSubs[ nFor, 2 ] )
   next

   do while !Empty( cToken := TextBetween( cCode, "<", ">", 1, @cLeft, @cRight ) )
      cCode    := cLeft + cRight
   enddo

   aSubs := { ;
      { '&gt;', ">"  }, ;
      { '&lt;', "<"  } }

   for nFor := 1 to Len( aSubs )
      cCode    := StrTran( cCode, aSubs[ nFor, 1 ], aSubs[ nFor, 2 ] )
   next
   do while !Empty( cToken := TextBetween( cCode, "&#", ";", 1, @cLeft, @cRight ) )
      cToken   := Chr( Val( cToken ) )
      cCode    := cLeft + cToken + cRight

   enddo

return cCode

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

function PageCount( cText )

   local nAt
   local nPages   := 1

   if ( nAt := AT( "Page <strong>", cText ) ) > 0
      cText    := SubStr( cText, nAt + 14, 50 )
      nPages   := Val( AfterAtNum( "<strong>", cText, 1 ) )
   endif

return nPages

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

function GetUserName( cText, dDate )

   local c1    := "/memberlist.php?mode=viewprofile&amp;u=" //2342">cnavarro</a></strong> &raquo; Tue Jan 17
   local c2    := ["username]
   local nAt   := RAT( c1, cText )
   local n2    := RAT( c2, cText )
   local cUser := "
"
   local cDate

   nAt      := Max( nAt, n2 )
   if nAt > 0
      cText    := SubStr( cText, nAt, 200 )
      cUser    := TextBetween( cText, "
>", "<", 1 )
      cDate    := AllTrim( TextBetween( cText, "
&raquo;", "</p>" ) )
      cDate    := Upper( AfterAtNum( "
", cDate, 1 ) )
      dDate    := uCharToVal( cDate, 'D' )
   endif

return cUser

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


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: get no disable y tampoco editable

Postby karinha » Fri May 07, 2021 11:56 am

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: get no disable y tampoco editable

Postby acuellar » Fri May 07, 2021 11:57 am

Estimado goosfancito

Y lo hago con SAY, claro no tiene SCROLL
Code: Select all  Expand view

@ 120,420 SAY oSay PROMPT  SAMPLES->CODE SIZE 460,540 PIXEL OF oDlg ;
       FONT oMono UPDATE
 
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: get no disable y tampoco editable

Postby karinha » Fri May 07, 2021 11:57 am

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: get no disable y tampoco editable

Postby karinha » Fri May 07, 2021 11:59 am

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: get no disable y tampoco editable

Postby goosfancito » Fri May 07, 2021 12:19 pm

Ese es el tema del porque no lo hago con say. como es un "texto" que va a ser variado no puedo hacerlo.

acuellar wrote:Estimado goosfancito

Y lo hago con SAY, claro no tiene SCROLL
Code: Select all  Expand view

@ 120,420 SAY oSay PROMPT  SAMPLES->CODE SIZE 460,540 PIXEL OF oDlg ;
       FONT oMono UPDATE
 
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: get no disable y tampoco editable

Postby nageswaragunupudi » Fri May 07, 2021 1:28 pm

@ r,c GET ........ MEMO .... READONLY is working.

Test sample:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oFont, oGet, oBtn
   local cText, cName := "Dummy"

   cText := MEMOREAD( "c:\fwh\samples\testxbr3.prg" )

   DEFINE FONT oFont NAME "LUCIDA CONSOLE" SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont

   @  20,380 BUTTON "CLOSE" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()

   @  80, 20 GET oGet VAR cText MEMO SIZE 460,400 PIXEL OF oDlg READONLY

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get no disable y tampoco editable

Postby nageswaragunupudi » Fri May 07, 2021 2:16 pm

RESOURCE:

Code: Select all  Expand view
  local oDlg, oFont, oGet, oBtn
   local cText, cName := "Dummy"

   cText := MEMOREAD( "c:\fwh\samples\testxbr3.prg" )

   DEFINE FONT oFont NAME "LUCIDA CONSOLE" SIZE 0,-12
   DEFINE DIALOG oDlg RESOURCE "MEMOGETDLG" FONT oFont

   REDEFINE GET oGet VAR cText MEMO ID 101 OF oDlg READONLY

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont
 


RC file
Code: Select all  Expand view
MEMOGETDLG DIALOG 6, 15, 306, 227
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "MEMOGET"
FONT 8, "MS Sans Serif"
{
 DEFPUSHBUTTON "OK", IDOK, 252, 211, 50, 14
 EDITTEXT 101, 4, 5, 297, 202, ES_MULTILINE | WS_VSCROLL | ES_READONLY | WS_BORDER
}
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get no disable y tampoco editable

Postby goosfancito » Sat May 15, 2021 8:48 pm

hello.

En mi programa muestra el error. Para replicar lo que hago:
1) copio un texto escrito en WORD o write que sea extenso
2) pego ese texto en el get
3) muevo el scroll

el error aparece.

otra cosa: el dato lo tomo de mysql, que esta declardo como MEMO y si hago esto:
vgets:= memored(oQry:fieldget("texto"))
vgests queda vacio.

si hago directamente:
vgets:= oQry:fieldget("texto")
vgets si queda con datos.

Image
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: get no disable y tampoco editable

Postby Antonio Linares » Sat May 15, 2021 9:41 pm

Gustavo,

Por favor copia aqui el código fuente de como construyes esa caja de diálogo

Y tambien el recurso correspondiente en caso de que la tengas creada en el fichero RC
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: get no disable y tampoco editable

Postby nageswaragunupudi » Sun May 16, 2021 3:42 am

WRONG
Another thing: I take the data from mysql, which is declared as MEMO and if I do this:
vgets: = memored (oQry: fieldget ("text"))
vgests is empty.


CORRECT
if I do directly:
vgets: = oQry: fieldget ("text")
vgets if it remains with data.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get no disable y tampoco editable

Postby nageswaragunupudi » Sun May 16, 2021 3:26 pm

En mi programa muestra el error. Para replicar lo que hago:
1) copio un texto escrito en WORD o write que sea extenso
2) pego ese texto en el get
3) muevo el scroll

el error aparece.


This is working perfectly here.

I posted two programs above. I tested with those programs by removing the READONLY clause from the program and ES_READONLY style in the RC file.

I opened "c:\fwh\manual\manual FWH english.doc" in MSWord and pasted in the Get. Working perfectly as can be seen here.

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests