say border RESOLVED

Re: say border

Postby richard-service » Thu Nov 18, 2021 10:02 am

Silvio.Falconi wrote:
richard-service wrote:Image



No Mr Richard
SEE this

Image


Say under line not say border ....
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 764
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: say border

Postby richard-service » Thu Nov 18, 2021 10:03 am

Otto wrote:Hello Richard,
I like your design.
Best regards,
Otto


Thank you...
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 764
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: say border

Postby Silvio.Falconi » Thu Nov 18, 2021 10:38 am

Now I resolved with Tslines class

bu tI must insert many say on a dialog and many control Tslines - No Good
I wished there was a solution directly on say class...


If you read the first my message at http://forums.fivetechsupport.com/viewtopic.php?f=3&t=41060&sid=97a2701f0fc1571a10b515c274b94f88&sid=97a2701f0fc1571a10b515c274b94f88#p245806
I 'm talking of a line under of tsay
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby karinha » Thu Nov 18, 2021 12:26 pm

Solved?

Can you post an example for other users? Whenever possible, contribute with those who are learning.
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: say border RESOLVED

Postby Silvio.Falconi » Thu Nov 18, 2021 12:45 pm

karinha wrote:Solved?

Can you post an example for other users? Whenever possible, contribute with those who are learning.


I used tslines but not is good
because I not undestood wich is the @x,y

@ 22, 10 say oSay[1] PROMPT "Denominazione:" SIZE 100,20 PIXEL OF oFolder:adialogs[1]
oLine1:=TSLines():New(oSay[1]:nbottom, 15, oSay[1]:nWidth+19, 2, "HLINE",oFolder:adialogs[1],nRgb(233,229,206) ,,, .t., , , , , , )



I have no reference even with the gets
Last edited by Silvio.Falconi on Tue Nov 23, 2021 11:25 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby karinha » Thu Nov 18, 2021 12:57 pm

Hi, with my version of FiveWin, it looks awful. And if I use TRANSPARENT in Dialog, the command doesn't work, which doesn't make sense, since BRUSH is in SAY and not DIALOG. Anyway, I prefer to use DSAY.PRG or SSAY.PRG, they leave me unlimited. thanks.

Hola, con mi versión de FiveWin, se ve horrible. Y si uso TRANSPARENT en Dialogo, el comando no funciona, lo que no tiene sentido, ya que BRUSH está en SAY y no en DIALOG. De todos modos, prefiero usar DSAY.PRG o SSAY.PRG, me dejan ilimitado. Gracias.


Code: Select all  Expand view

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL oSay   AS OBJECT
   LOCAL oBrush AS OBJECT
   LOCAL oDlg   AS OBJECT
   LOCAL oIco   AS OBJECT
   LOCAL oGet   AS OBJECT
   LOCAL cTest := "Hello world!   ", cTitle

   cTitle := "I am a DialogBox"

   DEFINE BRUSH oBrush FILENAME "../bitmaps/Backgrnd/Rainbow.bmp"

   DEFINE ICON oIco FILE "..\icons\fivewin.ico"

   DEFINE DIALOG oDlg TITLE cTitle SIZE 500, 500 ICON oIco ;
      COLORS CLR_BLACK, CLR_WHITE // TRANSPARENT -> No funciona

   oDlg:lHelpIcon := .F.

   @ 10, 10 SAY oSay PROMPT "Five Win" OF oDlg PIXEL SIZE 50, 20

   oSay:SetBrush( oBrush )

   @ 42, 10 GET oGet VAR cTest OF oDlg PIXEL SIZE 50, 12

   @ 4, 5 BUTTON "&Ok" SIZE 40, 12 ;
      ACTION MsgInfo( "Any action here!" ) DEFAULT

   @ 4, 16 BUTTON "&Exit" SIZE 40, 12 ACTION( oDlg:End() ) CANCEL

   ACTIVATE DIALOG oDlg CENTERED

   oBrush:End()

RETURN NIL
 


Regards, 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: say border RESOLVED

Postby Silvio.Falconi » Thu Nov 18, 2021 1:10 pm

I modify Tssay.prg
I add a data lLine and a method ::DrawLine()


Code: Select all  Expand view


// Sensitive Say control by Ramón Avendaño
// 23-02-00

#include "FiveWin.ch"
#include "Constant.ch"

#define SS_CENTER             1
#define SS_RIGHT              2
#define SS_GRAYRECT           5 // BOXRECT

#define TA_LEFT               0
#define TA_RIGHT              2
#define TA_CENTER             6
#define TA_TOP                0
#define TA_BOTTOM             8

#define COLOR_ACTIVECAPTION   2
#define COLOR_WINDOW          5
#define COLOR_WINDOWTEXT      8

#define COLOR_BTNSHADOW      16
#define COLOR_BTNHIGHLIGHT   20

#define WM_SYSCOMMAND       274  // 0x112
#define WM_NCHITTEST        132  // 0x84
#define WM_NCMOUSEMOVE      160  // 0xA0

#define GWL_STYLE         -16
#define GWL_EXSTYLE       -20

#define WS_EX_TRANSPARENT    32

#ifdef __XPP__
   #define Super ::TControl
   #define New   _New
#endif


Static oSSayOver
Static oWndMMovedParent, bMMovedParent

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

CLASS TSSay FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA   l3D
   DATA   cPicture
   DATA   aCaption
   DATA   bGet

   DATA   lTransparent
   DATA   lShaded, lBox, lRaised, lLine

   DATA   lOver
   DATA   nClrOver

   DATA   bAction
   DATA   bMOver, bNonMOver

   DATA   lDrawBox
   DATA   nSTop, nSLeft
   DATA   aRect
   DATA   nTxtWidth, nTxtHeight
   DATA   nAlign

   METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
               bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
               nClrText, nClrBack, nClrOver, nWidth, nHeight,;
               lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CONSTRUCTOR

   METHOD ReDefine( nId, bText, oWnd, cPicture,;
                    bAction, lCentered, lRight, lBottom,;
                    nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                    lShaded, lBox, lRaised, lTransparent, bMOver, lLine )  CONSTRUCTOR

   METHOD Default()

   METHOD Initiate( hDlg ) INLINE ::Super:Initiate( hDlg ), ::Default()

   METHOD HandleEvent( nMsg, nWParam, nLParam )

   METHOD Display() INLINE  ::BeginPaint(), ::Paint(), ::EndPaint()

   METHOD Paint()

   METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)

   METHOD ReSize( nType, nWidth, nHeight );
                  INLINE ::Default(), ::Super:ReSize( nType, nWidth, nHeight )

   METHOD SetText( cText ) INLINE ;
                    ::cCaption := If( ::cPicture != nil,;
                                  Transform( cText, ::cPicture ),;
                                  cValToChar( cText ) ),;
                                  ::Default(), ::Paint()

   METHOD DrawBox( lOnOff )

   METHOD LButtonDown( nRow, nCol, nFlags )
   METHOD LButtonUp( nRow, nCol, nFlags )

   METHOD MouseMove( nRow, nCol, nKeyFlags )
   METHOD NcMouseMove( nHitTestCode, nRow, nCol )

   METHOD VarPut( cValue )
   METHOD DrawLine()
ENDCLASS

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

METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
            bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
            nClrText, nClrBack, nClrOver, nWidth, nHeight,;
            lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CLASS TSSay

   DEFAULT nRow     := 0, nCol := 0,;
           lTransparent := .f.,;
           lBorder  := .f., lCentered := .f., lRight := .f., lBottom := .f., lPixels := .f.,;
           oWnd     := GetWndDefault(),;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           nHeight  := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ),;
           lDesign  := .f., bText := { || "" },;
           lUpdate  := .f., lShaded := .f., lBox := .f., lRaised := .f., lLine  := .f.

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::cCaption  = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                     Transform( Eval( bText ), cPicture ) )

   DEFAULT nWidth := ( If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W ) * Len( ::cCaption ) ) - 4  // 8

   if ! lPixels
      ::nTop  = nRow * If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) + 2        // 13
      ::nLeft = nCol * If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W )             // 8
   else
      ::nTop  = nRow
      ::nLeft = nCol
   endif

   ::nBottom   = ::nTop + nHeight - 1
   ::nRight    = ::nLeft + nWidth - 1

   ::oWnd      = oWnd
   ::oFont     = oFont
   ::oCursor   = oCursor
   ::bAction   = bAction
   ::nId       = ::GetNewId()
   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE,;
                 If( lDesign, nOr( WS_CLIPSIBLINGS, WS_TABSTOP ), 0 ),;
                 If( lBorder, WS_BORDER, 0 ) )
   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio

   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = lDesign
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if ! Empty( oWnd:hWnd )
      ::Create()
      ::Default()
      if ::l3D
         ::Set3DLook()
      endif
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   if ::lDrag
      ::CheckDots()
   endif

return Self

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

METHOD ReDefine( nId, bText, oWnd, cPicture,;
                 bAction, lCentered, lRight, lBottom,;
                 nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                 lShaded, lBox, lRaised, lTransparent, bMOver, lLine ) CLASS TSSay

   DEFAULT lTransparent := .f.,;
           lCentered := .f., lRight := .f., lBottom := .f.,;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           oWnd := GetWndDefault(),;
           lUpdate := .f., lShaded := .f., lBox := .f., lRaised := .f. ,lLine:=.f.

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nId       = nId
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::oFont     = oFont

   if bText != nil
      ::cCaption = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                       Transform( Eval( bText ), cPicture ) )
   endif

   ::oWnd      = oWnd
   ::hWnd      = 0
   ::oCursor   = oCursor
   ::bAction   = bAction

   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio


   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = .f.
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if oWnd != nil
      oWnd:DefControl( Self )
   endif

return Self

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

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSSay

   if ::lDrag .and. nMsg == WM_NCHITTEST
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   elseif nMsg == WM_NCMOUSEMOVE
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   endif

return ::Super:HandleEvent( nMsg, nWParam, nLParam )

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

METHOD Default() CLASS TSSay

   local lCentered := nAnd( ::nAlign, TA_CENTER ) == TA_CENTER
   local lRight    := nAnd( ::nAlign, TA_RIGHT ) == TA_RIGHT
   local lBottom   := nAnd( ::nAlign, TA_BOTTOM ) == TA_BOTTOM

   DEFAULT ::lDrawBox := .f.

   if ::oFont != nil
      ::SetFont( ::oFont )
   else
      ::SetFont( ::oWnd:oFont )
   endif

   ::nTxtWidth  = 0
   ::nTxtHeight = GetTextHeight( ::hWnd, 0 )

   if ! Empty( ::cCaption )
      SetWindowText( ::hWnd, ::cCaption )
   else
      ::cCaption = GetWindowText( ::hWnd )
   endif

   ::aCaption   = Array( MLCount( ::cCaption, 254 ) )
   AEval( ::aCaption, {|c, n| ::aCaption[ n ] := Trim( MemoLine( ::cCaption, 252, n ) ),;
                       ::nTxtWidth := Max( ::nTxtWidth, GetTextWidth( 0, ::aCaption[ n ],;
                       if( ::oFont != nil, ::oFont:hFont, 0 ) ) ) } )

   ::aRect := GetClientRect( ::hWnd )

   ::nSTop  := if( lBottom, ::aRect[ 3 ], 0 )
   ::nSLeft := if( lCentered, int( ::aRect[ 4 ] / 2 ), if( lRight, ::aRect[ 4 ], 0 ) )

   if ::lBox
      ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   elseif ::lShaded .or. ::lRaised
      ::aRect := { 1, 1, ::aRect[ 3 ] - 1, ::aRect[ 4 ] - 1 }
   elseif ::lLine   //by Silvio
     ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   endif

   if ::lTransparent
      SetWindowLong( ::hWnd, GWL_EXSTYLE,;
         nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ), WS_EX_TRANSPARENT ) )
   endif

   if oWndMMovedParent = nil .and. bMMovedParent = nil .and. ::oWnd:bMMoved != nil
      bMMovedParent := ::oWnd:bMMoved
   endif
   oWndMMovedParent := ::oWnd

   ::oWnd:bMMoved := {| nRow, nCol, nKeyFlags | NcSSayOver( nRow, nCol, nKeyFlags ) }

   if !::ltransparent
      InvalidateRect( ::hWnd, ::aRect, .t. )
   else
      InvalidateRect( ::oWnd:hWnd, { ::nTop + ::aRect[1], ::nLeft + ::aRect[2],;
                                     ::nTop + ::aRect[3], ::nLeft + ::aRect[4] }, .f. )
      SysRefresh()
   endif

return nil

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

METHOD Paint() CLASS TSSay

   local n
   local nColorShadow, nColorLight

   ::GetDC()

   if ::lActive

      for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                If( ::lOver, ::nClrOver, ::nClrText ),,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next

      if ::lDrawBox
         ::DrawBox( ::lOver )
      endif

   else

      nColorShadow := GetSysColor( COLOR_BTNSHADOW )
      nColorLight  := GetSysColor( COLOR_BTNHIGHLIGHT )

      for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight + 1, ::nSLeft + 1, ::aCaption[ n ], nColorLight,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ], nColorShadow,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next

   endif

   // 3D

   if ::lShaded
      WndInset( ::hWnd, ::hDC )   // SHADED, SHADOW
   endif

   if ::lRaised
      WndRaised( ::hWnd, ::hDC )  // RAISED
   endif

   if ::lBox
       WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
      WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
   endif

    if ::lLine
       ::DrawLine()
    endif

   ::ReleaseDC()

   if ::lTransparent
      SysRefresh()
   endif

return nil

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

METHOD DrawBox( lOnOff ) CLASS TSSay

 * local hPen := CreatePen( PS_SOLID, 1, if( .T., ::oWnd:nClrText, ::oWnd:nClrPane ) )
  local hPen := CreatePen( PS_SOLID, 1, CLR_BLACK )
  MoveTo( ::hDC, ::aRect[2], ::aRect[1] )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[1], hPen )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[1], hPen )

  DeleteObject( hPen )

  return nil

METHOD DrawLine() CLASS TSSay

  FillSolidRect( ::hDC, {::aRect[4]+6,::aRect[1],::aRect[3],::aRect[4]}, CLR_HGRAY )


return nil
//----------------------------------------------------------------------------//

METHOD LButtonDown( nRow, nCol, nFlags ) CLASS TSSay

   local nPos, aRect

   if !::lActive .or. ::lDrag
      return ::Super:LButtonDown( nRow, nCol, nFlags )
   endif

   ::Super:LButtonDown( nRow, nCol, nFlags )

return nil

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

METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return ::Super:LButtonUp( nRow, nCol, nFlags )
   endif

   if ::bAction != nil
      Eval( ::bAction, Self )
   endif

   ::Super:LButtonUp( nRow, nCol, nFlags )

return nil

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

METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TSSay

   ::SetMsg( ::cMsg )

   ::CheckToolTip()

   if !::lActive .or. ::lDrag
      return ::Super:MouseMove( nRow, nCol, nKeyFlags )
   endif

   if !::lOver

      if oSSayOver != nil
         NcSSayOver( nRow, nCol, nKeyFlags )
      endif

      ::lOver := .t.
      oSSayOver := Self

      ::Paint()

      if ::bMOver != nil
         Eval( ::bMOver )
      endif

   endif

   if ::oCursor != nil
      SetCursor( ::oCursor:hCursor )
   else
      CursorHAND()
   endif

return 0

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

METHOD NcMouseMove( nHitTestCode, nRow, nCol ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return ::Super:NcMouseMove( nHitTestCode, nRow, nCol )
   endif

   if ::lOver
      ::lOver := .f.
      oSSayOver := nil

      ::Paint()

      if ::bNonMOver != nil
         Eval( ::bNonMOver )
      endif

   endif

return 0

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

METHOD VarPut( cValue ) CLASS TSSay

   if ! Empty( ::cPicture )
      cValue = Transform( cValue, ::cPicture )
   else
      cValue = cValToChar( cValue )
   endif

   ::bGet = { || cValue }

return nil


//  Public functions
//----------------------------------------------------------------------------//

function NcSSayOver( nRow, nCol, nKeyFlags )

  if oSSayOver != nil
     oSSayOver:NcMouseMove( 0, nRow, nCol )
  endif

  if bMMovedParent != nil
     Eval( bMMovedParent, nRow, nCol, nKeyFlags )
  endif

return nil

//----------------------------------------------------------------------------//
// R.Avendaño. 1998

 


Image
Test
Code: Select all  Expand view


 Function TestMio()
   local oDlg,oFont1,oSay[2]
   local oGet[2]
   local oFont


      DEFINE FONT oFont1 NAME "Arial" SIZE 0, -16 BOLD
      DEFINE FONT oFont NAME "Arial" SIZE 0, -14

      DEFINE DIALOG oDlg SIZE 422, 326 PIXEL ; //FROM 100, 100 TO 426,522;
      TITLE "test with Line" FONT oFont TRANSPARENT ;
       COLOR CLR_BLACK,nRgb(240,237,220)

   
    @ 26, 10 SENSITIVE SAY oSay[1] Prompt  "Cognome :" SIZE 55, 13 PIXEL  FONT oFont1  
    oSay[1]:lActive := .f.
    oSay[1]:lLine :=.t.
   @ 26, 75 GET oGet[1]    OF oDlg SIZE 105, 12 PIXEL

 
   @ 40, 10 SENSITIVE SAY oSay[2] Prompt  "Nome :" SIZE 55, 13 PIXEL  FONT oFont1
    oSay[2]:lActive := .f.
    oSay[2]:lLine :=.t.
   @ 40, 75 GET oGet[2]     OF oDlg SIZE 105, 12 PIXEL



          ACTIVATE DIALOG oDlg

  RELEASE FONT oFont1
  RELEASE FONT oFont
return nil

 


But I not Know how change the color of the say I see a marron instead of clr_black because I make lactive:=.f. and the clrtext is faded
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby Silvio.Falconi » Thu Nov 18, 2021 1:16 pm

ok corrected

modify the paint method
Code: Select all  Expand view
METHOD Paint() CLASS TSSay

   local n
   local nColorShadow, nColorLight

   ::GetDC()

   if ::lActive

      for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                If( ::lOver, ::nClrOver, ::nClrText ),,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next

      if ::lDrawBox
         ::DrawBox( ::lOver )
      endif

   else

      nColorShadow := GetSysColor( COLOR_BTNSHADOW )
      nColorLight  := GetSysColor( COLOR_BTNHIGHLIGHT )

      If ::lline
          for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                If( ::lOver, ::nClrOver, ::nClrText ),,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next

         else
      for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight + 1, ::nSLeft + 1, ::aCaption[ n ], nColorLight,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ], nColorShadow,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next
     endif
   endif

   // 3D

   if ::lShaded
      WndInset( ::hWnd, ::hDC )   // SHADED, SHADOW
   endif

   if ::lRaised
      WndRaised( ::hWnd, ::hDC )  // RAISED
   endif

   if ::lBox
       WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
      WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
   endif

    if ::lLine
       ::DrawLine()
    endif

   ::ReleaseDC()

   if ::lTransparent
      SysRefresh()
   endif

return nil

//----------------------------------------------------------------------------//
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby karinha » Thu Nov 18, 2021 1:25 pm

Muy bien Silvio. SSAY.PRG es maravilloso. Luego, cuando tengas tiempo, echa un vistazo a DSAY.PRG, lo uso mucho, es simplemente excelente. Puede hacer lo que quiera con cualquiera de las dos clases. Gracias.

Very good Silvio. SSAY.PRG is wonderful. Then, when you have time, check out DSAY.PRG, I use it a lot, it's just excellent. You can do whatever you want with either of the two classes. thanks.

Regards, 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: say border RESOLVED

Postby Silvio.Falconi » Fri Nov 19, 2021 12:35 am

karinha wrote:Muy bien Silvio. SSAY.PRG es maravilloso. Luego, cuando tengas tiempo, echa un vistazo a DSAY.PRG, lo uso mucho, es simplemente excelente. Puede hacer lo que quiera con cualquiera de las dos clases. Gracias.

Very good Silvio. SSAY.PRG is wonderful. Then, when you have time, check out DSAY.PRG, I use it a lot, it's just excellent. You can do whatever you want with either of the two classes. thanks.

Regards, saludos.



I corrected some bugs and add also the color for the line init clr_hGray

Code: Select all  Expand view
// Sensitive Say control by Ramón Avendaño
// 23-02-00

#include "FiveWin.ch"
#include "Constant.ch"

#define SS_CENTER             1
#define SS_RIGHT              2
#define SS_GRAYRECT           5 // BOXRECT

#define TA_LEFT               0
#define TA_RIGHT              2
#define TA_CENTER             6
#define TA_TOP                0
#define TA_BOTTOM             8

#define COLOR_ACTIVECAPTION   2
#define COLOR_WINDOW          5
#define COLOR_WINDOWTEXT      8

#define COLOR_BTNSHADOW      16
#define COLOR_BTNHIGHLIGHT   20

#define WM_SYSCOMMAND       274  // 0x112
#define WM_NCHITTEST        132  // 0x84
#define WM_NCMOUSEMOVE      160  // 0xA0

#define GWL_STYLE         -16
#define GWL_EXSTYLE       -20

#define WS_EX_TRANSPARENT    32

#ifdef __XPP__
   #define Super ::TControl
   #define New   _New
#endif


Static oSSayOver
Static oWndMMovedParent, bMMovedParent

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

CLASS TSSay FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA   l3D
   DATA   cPicture
   DATA   aCaption
   DATA   bGet

   DATA   lTransparent
   DATA   lShaded, lBox, lRaised


   DATA   lOver
   DATA   nClrOver

   DATA   bAction
   DATA   bMOver, bNonMOver

   DATA   lDrawBox
   DATA   nSTop, nSLeft
   DATA   aRect
   DATA   nTxtWidth, nTxtHeight
   DATA   nAlign


   DATA   nClrLine AS NUMERIC INIT CLR_HGRAY  //By Silvio
   DATA   lLine //By Silvio

   METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
               bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
               nClrText, nClrBack, nClrOver, nWidth, nHeight,;
               lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CONSTRUCTOR

   METHOD ReDefine( nId, bText, oWnd, cPicture,;
                    bAction, lCentered, lRight, lBottom,;
                    nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                    lShaded, lBox, lRaised, lTransparent, bMOver, lLine )  CONSTRUCTOR

   METHOD Default()

   METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()

   METHOD HandleEvent( nMsg, nWParam, nLParam )

   METHOD Display() INLINE  ::BeginPaint(), ::Paint(), ::EndPaint()

   METHOD Paint()

   METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)

   METHOD ReSize( nType, nWidth, nHeight );
                  INLINE ::Default(), Super:ReSize( nType, nWidth, nHeight )

   METHOD SetText( cText ) INLINE ;
                    ::cCaption := If( ::cPicture != nil,;
                                  Transform( cText, ::cPicture ),;
                                  cValToChar( cText ) ),;
                                  ::Default(), ::Paint()

   METHOD DrawBox( lOnOff )

   METHOD LButtonDown( nRow, nCol, nFlags )
   METHOD LButtonUp( nRow, nCol, nFlags )

   METHOD MouseMove( nRow, nCol, nKeyFlags )
   METHOD NcMouseMove( nHitTestCode, nRow, nCol )

   METHOD VarPut( cValue )

   METHOD DrawLine()   //By Silvio
ENDCLASS

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

METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
            bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
            nClrText, nClrBack, nClrOver, nWidth, nHeight,;
            lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CLASS TSSay

   DEFAULT nRow     := 0, nCol := 0,;
           lTransparent := .f.,;
           lBorder  := .f., lCentered := .f., lRight := .f., lBottom := .f., lPixels := .f.,;
           oWnd     := GetWndDefault(),;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           nHeight  := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ),;
           lDesign  := .f., bText := { || "" },;
           lUpdate  := .f., lShaded := .f., lBox := .f., lRaised := .f.

      DEFAULT lLine:=.f. //by Silvio


   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::cCaption  = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                     Transform( Eval( bText ), cPicture ) )

   DEFAULT nWidth := ( If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W ) * Len( ::cCaption ) ) - 4  // 8

   if ! lPixels
      ::nTop  = nRow * If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) + 2        // 13
      ::nLeft = nCol * If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W )             // 8
   else
      ::nTop  = nRow
      ::nLeft = nCol
   endif

   ::nBottom   = ::nTop + nHeight - 1
   ::nRight    = ::nLeft + nWidth - 1

   ::oWnd      = oWnd
   ::oFont     = oFont
   ::oCursor   = oCursor
   ::bAction   = bAction
   ::nId       = ::GetNewId()
   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE,;
                 If( lDesign, nOr( WS_CLIPSIBLINGS, WS_TABSTOP ), 0 ),;
                 If( lBorder, WS_BORDER, 0 ) )
   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio

   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = lDesign
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if ! Empty( oWnd:hWnd )
      ::Create()
      ::Default()
      if ::l3D
         ::Set3DLook()
      endif
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   if ::lDrag
      ::CheckDots()
   endif

return Self

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

METHOD ReDefine( nId, bText, oWnd, cPicture,;
                 bAction, lCentered, lRight, lBottom,;
                 nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                 lShaded, lBox, lRaised, lTransparent, bMOver, lLine ) CLASS TSSay

   DEFAULT lTransparent := .f.,;
           lCentered := .f., lRight := .f., lBottom := .f.,;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           oWnd := GetWndDefault(),;
           lUpdate := .f., lShaded := .f., lBox := .f., lRaised := .f.

           DEFAULT lLine:=.f. //by Silvio

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nId       = nId
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::oFont     = oFont

   if bText != nil
      ::cCaption = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                       Transform( Eval( bText ), cPicture ) )
   endif

   ::oWnd      = oWnd
   ::hWnd      = 0
   ::oCursor   = oCursor
   ::bAction   = bAction

   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio


   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = .f.
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if oWnd != nil
      oWnd:DefControl( Self )
   endif

return Self

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

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSSay

   if ::lDrag .and. nMsg == WM_NCHITTEST
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   elseif nMsg == WM_NCMOUSEMOVE
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   endif

return Super:HandleEvent( nMsg, nWParam, nLParam )

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

METHOD Default() CLASS TSSay

   local lCentered := nAnd( ::nAlign, TA_CENTER ) == TA_CENTER
   local lRight    := nAnd( ::nAlign, TA_RIGHT ) == TA_RIGHT
   local lBottom   := nAnd( ::nAlign, TA_BOTTOM ) == TA_BOTTOM

   DEFAULT ::lDrawBox := .f.

   if ::oFont != nil
      ::SetFont( ::oFont )
   else
      ::SetFont( ::oWnd:oFont )
   endif

   ::nTxtWidth  = 0
   ::nTxtHeight = GetTextHeight( ::hWnd, 0 )

   if ! Empty( ::cCaption )
      SetWindowText( ::hWnd, ::cCaption )
   else
      ::cCaption = GetWindowText( ::hWnd )
   endif

   ::aCaption   = Array( MLCount( ::cCaption, 254 ) )
   AEval( ::aCaption, {|c, n| ::aCaption[ n ] := Trim( MemoLine( ::cCaption, 252, n ) ),;
                       ::nTxtWidth := Max( ::nTxtWidth, GetTextWidth( 0, ::aCaption[ n ],;
                       if( ::oFont != nil, ::oFont:hFont, 0 ) ) ) } )

   ::aRect := GetClientRect( ::hWnd )

   ::nSTop  := if( lBottom, ::aRect[ 3 ], 0 )
   ::nSLeft := if( lCentered, int( ::aRect[ 4 ] / 2 ), if( lRight, ::aRect[ 4 ], 0 ) )

   if ::lBox
      ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   elseif ::lShaded .or. ::lRaised
      ::aRect := { 1, 1, ::aRect[ 3 ] - 1, ::aRect[ 4 ] - 1 }
   elseif ::lLine   //by Silvio
     ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   endif

   if ::lTransparent
      SetWindowLong( ::hWnd, GWL_EXSTYLE,;
         nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ), WS_EX_TRANSPARENT ) )
   endif

   if oWndMMovedParent = nil .and. bMMovedParent = nil .and. ::oWnd:bMMoved != nil
      bMMovedParent := ::oWnd:bMMoved
   endif
   oWndMMovedParent := ::oWnd

   ::oWnd:bMMoved := {| nRow, nCol, nKeyFlags | NcSSayOver( nRow, nCol, nKeyFlags ) }

   if !::ltransparent
      InvalidateRect( ::hWnd, ::aRect, .t. )
   else
      InvalidateRect( ::oWnd:hWnd, { ::nTop + ::aRect[1], ::nLeft + ::aRect[2],;
                                     ::nTop + ::aRect[3], ::nLeft + ::aRect[4] }, .f. )
      SysRefresh()
   endif

return nil

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

    METHOD Paint() CLASS TSSay

       local n
       local nColorShadow, nColorLight

       ::GetDC()

       if ::lActive

          for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                    If( ::lOver, ::nClrOver, ::nClrText ),,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          next

          if ::lDrawBox
             ::DrawBox( ::lOver )
          endif

       else

          nColorShadow := GetSysColor( COLOR_BTNSHADOW )
          nColorLight  := GetSysColor( COLOR_BTNHIGHLIGHT )

          If ::lLine  //by Silvio
              for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                    If( ::lOver, ::nClrOver, ::nClrText ),,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
                next

             else

          for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight + 1, ::nSLeft + 1, ::aCaption[ n ], nColorLight,,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ], nColorShadow,,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          next
         endif
       endif

       // 3D

       if ::lShaded
          WndInset( ::hWnd, ::hDC )   // SHADED, SHADOW
       endif

       if ::lRaised
          WndRaised( ::hWnd, ::hDC )  // RAISED
       endif

       if ::lBox
           WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
          WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
       endif

        if ::lLine
           ::DrawLine()
        endif

       ::ReleaseDC()

       if ::lTransparent
          SysRefresh()
       endif

    return nil


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

METHOD DrawBox( lOnOff ) CLASS TSSay

  local hPen := CreatePen( PS_SOLID, 1, if( .T., ::oWnd:nClrText, ::oWnd:nClrPane ) )
  MoveTo( ::hDC, ::aRect[2], ::aRect[1] )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[1], hPen )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[1], hPen )

  DeleteObject( hPen )

  return nil
//----------------------------------------------------------------------------//

METHOD DrawLine() CLASS TSSay

  FillSolidRect( ::hDC, {::aRect[4]+6,::aRect[1],::aRect[3],::aRect[4]}, ::nClrLine )


return nil
//----------------------------------------------------------------------------//

METHOD LButtonDown( nRow, nCol, nFlags ) CLASS TSSay

   local nPos, aRect

   if !::lActive .or. ::lDrag
      return Super:LButtonDown( nRow, nCol, nFlags )
   endif

   Super:LButtonDown( nRow, nCol, nFlags )

return nil

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

METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return Super:LButtonUp( nRow, nCol, nFlags )
   endif

   if ::bAction != nil
      Eval( ::bAction, Self )
   endif

   Super:LButtonUp( nRow, nCol, nFlags )

return nil

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

METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TSSay

   ::SetMsg( ::cMsg )

   ::CheckToolTip()

   if !::lActive .or. ::lDrag
      return Super:MouseMove( nRow, nCol, nKeyFlags )
   endif

   if !::lOver

      if oSSayOver != nil
         NcSSayOver( nRow, nCol, nKeyFlags )
      endif

      ::lOver := .t.
      oSSayOver := Self

      ::Paint()

      if ::bMOver != nil
         Eval( ::bMOver )
      endif

   endif

   if ::oCursor != nil
      SetCursor( ::oCursor:hCursor )
   else
      CursorHAND()
   endif

return 0

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

METHOD NcMouseMove( nHitTestCode, nRow, nCol ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return Super:NcMouseMove( nHitTestCode, nRow, nCol )
   endif

   if ::lOver
      ::lOver := .f.
      oSSayOver := nil

      ::Paint()

      if ::bNonMOver != nil
         Eval( ::bNonMOver )
      endif

   endif

return 0

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

METHOD VarPut( cValue ) CLASS TSSay

   if ! Empty( ::cPicture )
      cValue = Transform( cValue, ::cPicture )
   else
      cValue = cValToChar( cValue )
   endif

   ::bGet = { || cValue }

return nil


//  Public functions
//----------------------------------------------------------------------------//

function NcSSayOver( nRow, nCol, nKeyFlags )

  if oSSayOver != nil
     oSSayOver:NcMouseMove( 0, nRow, nCol )
  endif

  if bMMovedParent != nil
     Eval( bMMovedParent, nRow, nCol, nKeyFlags )
  endif

return nil

//----------------------------------------------------------------------------//
// R.Avendaño. 1998

 



a Small test

Code: Select all  Expand view
 @ 10, 10 SENSITIVE SAY aSay[1] Prompt  "Denominazione :" SIZE 60, 13 PIXEL OF oFolder:aDialogs[1] FONT oFontDialog
        @ 10, 85 GET aGet[1] VAR cDenominazione    SIZE 350, 12 PIXEL  OF oFolder:aDialogs[1]
        @ 24, 10 SENSITIVE SAY aSay[2] Prompt  "Indirizzo :" SIZE 60, 13 PIXEL OF oFolder:aDialogs[1] FONT oFontDialog
        @ 24, 85 GET aGet[2] VAR cIndirizzo    SIZE 350, 12 PIXEL  OF oFolder:aDialogs[1]
        @ 40, 10 SENSITIVE SAY aSay[3] Prompt  "Cap :" SIZE 60, 13 PIXEL OF oFolder:aDialogs[1] FONT oFontDialog
        @ 40, 85 GET aGet[3] VAR cCap    SIZE 50, 12 PIXEL  OF oFolder:aDialogs[1]
        @ 40, 140 SENSITIVE SAY aSay[4] Prompt  "Città :" SIZE 40, 13 PIXEL OF oFolder:aDialogs[1] FONT oFontDialog
        @ 40, 180 GET aGet[4] VAR clocalita    SIZE 200, 12 PIXEL  OF oFolder:aDialogs[1]

 For n= 1 to 4
        aSay[n]:lActive := .f.
        aSay[n]:lLine :=.t.
     next


Result


any suggestion ?
perhaps the line is too big ?
Last edited by Silvio.Falconi on Tue Nov 23, 2021 11:25 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby Silvio.Falconi » Fri Nov 19, 2021 12:52 am

you can use also

::Line( ::aRect[3],::aRect[1],::aRect[3],::aRect[4], ::nClrLine, 1 ) from twindow


instead od drawline



Code: Select all  Expand view



// Sensitive Say control by Ramón Avendaño
// 23-02-00

#include "FiveWin.ch"
#include "Constant.ch"

#define SS_CENTER             1
#define SS_RIGHT              2
#define SS_GRAYRECT           5 // BOXRECT

#define TA_LEFT               0
#define TA_RIGHT              2
#define TA_CENTER             6
#define TA_TOP                0
#define TA_BOTTOM             8

#define COLOR_ACTIVECAPTION   2
#define COLOR_WINDOW          5
#define COLOR_WINDOWTEXT      8

#define COLOR_BTNSHADOW      16
#define COLOR_BTNHIGHLIGHT   20

#define WM_SYSCOMMAND       274  // 0x112
#define WM_NCHITTEST        132  // 0x84
#define WM_NCMOUSEMOVE      160  // 0xA0

#define GWL_STYLE         -16
#define GWL_EXSTYLE       -20

#define WS_EX_TRANSPARENT    32

#ifdef __XPP__
   #define Super ::TControl
   #define New   _New
#endif


Static oSSayOver
Static oWndMMovedParent, bMMovedParent

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

CLASS TSSay FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA   l3D
   DATA   cPicture
   DATA   aCaption
   DATA   bGet

   DATA   lTransparent
   DATA   lShaded, lBox, lRaised


   DATA   lOver
   DATA   nClrOver

   DATA   bAction
   DATA   bMOver, bNonMOver

   DATA   lDrawBox
   DATA   nSTop, nSLeft
   DATA   aRect
   DATA   nTxtWidth, nTxtHeight
   DATA   nAlign


   DATA   nClrLine AS NUMERIC INIT CLR_HGRAY  //By Silvio
   DATA   lLine //By Silvio

   METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
               bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
               nClrText, nClrBack, nClrOver, nWidth, nHeight,;
               lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CONSTRUCTOR

   METHOD ReDefine( nId, bText, oWnd, cPicture,;
                    bAction, lCentered, lRight, lBottom,;
                    nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                    lShaded, lBox, lRaised, lTransparent, bMOver, lLine )  CONSTRUCTOR

   METHOD Default()

   METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()

   METHOD HandleEvent( nMsg, nWParam, nLParam )

   METHOD Display() INLINE  ::BeginPaint(), ::Paint(), ::EndPaint()

   METHOD Paint()

   METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)

   METHOD ReSize( nType, nWidth, nHeight );
                  INLINE ::Default(), Super:ReSize( nType, nWidth, nHeight )

   METHOD SetText( cText ) INLINE ;
                    ::cCaption := If( ::cPicture != nil,;
                                  Transform( cText, ::cPicture ),;
                                  cValToChar( cText ) ),;
                                  ::Default(), ::Paint()

   METHOD DrawBox( lOnOff )

   METHOD LButtonDown( nRow, nCol, nFlags )
   METHOD LButtonUp( nRow, nCol, nFlags )

   METHOD MouseMove( nRow, nCol, nKeyFlags )
   METHOD NcMouseMove( nHitTestCode, nRow, nCol )

   METHOD VarPut( cValue )

   METHOD Line( nTop, nLeft, nBottom, nRight, nColor, nSize )  // from TWindow

ENDCLASS

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

METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont, oCursor,;
            bAction, lCentered, lRight, lBottom, lBorder, lPixels,;
            nClrText, nClrBack, nClrOver, nWidth, nHeight,;
            lDesign, lUpdate, lShaded, lBox, lRaised, lTransparent, bMOver,lLine ) CLASS TSSay

   DEFAULT nRow     := 0, nCol := 0,;
           lTransparent := .f.,;
           lBorder  := .f., lCentered := .f., lRight := .f., lBottom := .f., lPixels := .f.,;
           oWnd     := GetWndDefault(),;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           nHeight  := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ),;
           lDesign  := .f., bText := { || "" },;
           lUpdate  := .f., lShaded := .f., lBox := .f., lRaised := .f.

      DEFAULT lLine:=.f. //by Silvio


   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::cCaption  = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                     Transform( Eval( bText ), cPicture ) )

   DEFAULT nWidth := ( If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W ) * Len( ::cCaption ) ) - 4  // 8

   if ! lPixels
      ::nTop  = nRow * If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) + 2        // 13
      ::nLeft = nCol * If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W )             // 8
   else
      ::nTop  = nRow
      ::nLeft = nCol
   endif

   ::nBottom   = ::nTop + nHeight - 1
   ::nRight    = ::nLeft + nWidth - 1

   ::oWnd      = oWnd
   ::oFont     = oFont
   ::oCursor   = oCursor
   ::bAction   = bAction
   ::nId       = ::GetNewId()
   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE,;
                 If( lDesign, nOr( WS_CLIPSIBLINGS, WS_TABSTOP ), 0 ),;
                 If( lBorder, WS_BORDER, 0 ) )
   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio

   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = lDesign
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if ! Empty( oWnd:hWnd )
      ::Create()
      ::Default()
      if ::l3D
         ::Set3DLook()
      endif
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   if ::lDrag
      ::CheckDots()
   endif

return Self

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

METHOD ReDefine( nId, bText, oWnd, cPicture,;
                 bAction, lCentered, lRight, lBottom,;
                 nClrText, nClrBack, nClrOver, lUpdate, oFont, oCursor,;
                 lShaded, lBox, lRaised, lTransparent, bMOver, lLine ) CLASS TSSay

   DEFAULT lTransparent := .f.,;
           lCentered := .f., lRight := .f., lBottom := .f.,;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nClrOver := GetSysColor( COLOR_ACTIVECAPTION ),;
           oWnd := GetWndDefault(),;
           lUpdate := .f., lShaded := .f., lBox := .f., lRaised := .f.

           DEFAULT lLine:=.f. //by Silvio

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nId       = nId
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::oFont     = oFont

   if bText != nil
      ::cCaption = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                       Transform( Eval( bText ), cPicture ) )
   endif

   ::oWnd      = oWnd
   ::hWnd      = 0
   ::oCursor   = oCursor
   ::bAction   = bAction

   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lLine    = lLine  //by Silvio


   ::lOver     = .f.
   ::nClrOver  = nClrOver
   ::bMOver    = bMOver

   ::lDrag     = .f.
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::lTransparent = lTransparent

   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if oWnd != nil
      oWnd:DefControl( Self )
   endif

return Self

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

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSSay

   if ::lDrag .and. nMsg == WM_NCHITTEST
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   elseif nMsg == WM_NCMOUSEMOVE
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   endif

return Super:HandleEvent( nMsg, nWParam, nLParam )

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

METHOD Default() CLASS TSSay

   local lCentered := nAnd( ::nAlign, TA_CENTER ) == TA_CENTER
   local lRight    := nAnd( ::nAlign, TA_RIGHT ) == TA_RIGHT
   local lBottom   := nAnd( ::nAlign, TA_BOTTOM ) == TA_BOTTOM

   DEFAULT ::lDrawBox := .f.

   if ::oFont != nil
      ::SetFont( ::oFont )
   else
      ::SetFont( ::oWnd:oFont )
   endif

   ::nTxtWidth  = 0
   ::nTxtHeight = GetTextHeight( ::hWnd, 0 )

   if ! Empty( ::cCaption )
      SetWindowText( ::hWnd, ::cCaption )
   else
      ::cCaption = GetWindowText( ::hWnd )
   endif

   ::aCaption   = Array( MLCount( ::cCaption, 254 ) )
   AEval( ::aCaption, {|c, n| ::aCaption[ n ] := Trim( MemoLine( ::cCaption, 252, n ) ),;
                       ::nTxtWidth := Max( ::nTxtWidth, GetTextWidth( 0, ::aCaption[ n ],;
                       if( ::oFont != nil, ::oFont:hFont, 0 ) ) ) } )

   ::aRect := GetClientRect( ::hWnd )

   ::nSTop  := if( lBottom, ::aRect[ 3 ], 0 )
   ::nSLeft := if( lCentered, int( ::aRect[ 4 ] / 2 ), if( lRight, ::aRect[ 4 ], 0 ) )

   if ::lBox
      ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   elseif ::lShaded .or. ::lRaised
      ::aRect := { 1, 1, ::aRect[ 3 ] - 1, ::aRect[ 4 ] - 1 }
   elseif ::lLine   //by Silvio
     ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   endif

   if ::lTransparent
      SetWindowLong( ::hWnd, GWL_EXSTYLE,;
         nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ), WS_EX_TRANSPARENT ) )
   endif

   if oWndMMovedParent = nil .and. bMMovedParent = nil .and. ::oWnd:bMMoved != nil
      bMMovedParent := ::oWnd:bMMoved
   endif
   oWndMMovedParent := ::oWnd

   ::oWnd:bMMoved := {| nRow, nCol, nKeyFlags | NcSSayOver( nRow, nCol, nKeyFlags ) }

   if !::ltransparent
      InvalidateRect( ::hWnd, ::aRect, .t. )
   else
      InvalidateRect( ::oWnd:hWnd, { ::nTop + ::aRect[1], ::nLeft + ::aRect[2],;
                                     ::nTop + ::aRect[3], ::nLeft + ::aRect[4] }, .f. )
      SysRefresh()
   endif

return nil

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

    METHOD Paint() CLASS TSSay

       local n
       local nColorShadow, nColorLight

       ::GetDC()

       if ::lActive

          for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                    If( ::lOver, ::nClrOver, ::nClrText ),,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          next

          if ::lDrawBox
             ::DrawBox( ::lOver )
          endif

       else

          nColorShadow := GetSysColor( COLOR_BTNSHADOW )
          nColorLight  := GetSysColor( COLOR_BTNHIGHLIGHT )

          If ::lLine  //by Silvio
              for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ],;
                    If( ::lOver, ::nClrOver, ::nClrText ),,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
                next

             else

          for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight + 1, ::nSLeft + 1, ::aCaption[ n ], nColorLight,,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight, ::nSLeft, ::aCaption[ n ], nColorShadow,,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          next
         endif
       endif

       // 3D

       if ::lShaded
          WndInset( ::hWnd, ::hDC )   // SHADED, SHADOW
       endif

       if ::lRaised
          WndRaised( ::hWnd, ::hDC )  // RAISED
       endif

       if ::lBox
           WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
          WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
       endif

       if ::lLine
           ::Line( ::aRect[3],::aRect[1],::aRect[3],::aRect[4], ::nClrLine, 1 )
        endif

       ::ReleaseDC()

       if ::lTransparent
          SysRefresh()
       endif

    return nil


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

METHOD DrawBox( lOnOff ) CLASS TSSay

  local hPen := CreatePen( PS_SOLID, 1, if( .T., ::oWnd:nClrText, ::oWnd:nClrPane ) )
  MoveTo( ::hDC, ::aRect[2], ::aRect[1] )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[1], hPen )
  LineTo( ::hDC, ::aRect[4] - 1, ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[3] - 1, hPen )
  LineTo( ::hDC, ::aRect[2], ::aRect[1], hPen )

  DeleteObject( hPen )

  return nil

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

METHOD LButtonDown( nRow, nCol, nFlags ) CLASS TSSay

   local nPos, aRect

   if !::lActive .or. ::lDrag
      return Super:LButtonDown( nRow, nCol, nFlags )
   endif

   Super:LButtonDown( nRow, nCol, nFlags )

return nil

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

METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return Super:LButtonUp( nRow, nCol, nFlags )
   endif

   if ::bAction != nil
      Eval( ::bAction, Self )
   endif

   Super:LButtonUp( nRow, nCol, nFlags )

return nil

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

METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TSSay

   ::SetMsg( ::cMsg )

   ::CheckToolTip()

   if !::lActive .or. ::lDrag
      return Super:MouseMove( nRow, nCol, nKeyFlags )
   endif

   if !::lOver

      if oSSayOver != nil
         NcSSayOver( nRow, nCol, nKeyFlags )
      endif

      ::lOver := .t.
      oSSayOver := Self

      ::Paint()

      if ::bMOver != nil
         Eval( ::bMOver )
      endif

   endif

   if ::oCursor != nil
      SetCursor( ::oCursor:hCursor )
   else
      CursorHAND()
   endif

return 0

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

METHOD NcMouseMove( nHitTestCode, nRow, nCol ) CLASS TSSay

   if !::lActive .or. ::lDrag
      return Super:NcMouseMove( nHitTestCode, nRow, nCol )
   endif

   if ::lOver
      ::lOver := .f.
      oSSayOver := nil

      ::Paint()

      if ::bNonMOver != nil
         Eval( ::bNonMOver )
      endif

   endif

return 0

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

METHOD VarPut( cValue ) CLASS TSSay

   if ! Empty( ::cPicture )
      cValue = Transform( cValue, ::cPicture )
   else
      cValue = cValToChar( cValue )
   endif

   ::bGet = { || cValue }

return nil


//  Public functions
//----------------------------------------------------------------------------//

function NcSSayOver( nRow, nCol, nKeyFlags )

  if oSSayOver != nil
     oSSayOver:NcMouseMove( 0, nRow, nCol )
  endif

  if bMMovedParent != nil
     Eval( bMMovedParent, nRow, nCol, nKeyFlags )
  endif

return nil

//----------------------------------------------------------------------------//
// R.Avendaño. 1998

METHOD Line( nTop, nLeft, nBottom, nRight, nColor, nSize ) CLASS TSSay
   // nColor can be oPen/hPen also. Then nSize should be nil

   local hPen, lNewPen, hOldPen

   ::GetDC()
   hPen     := hValToPen( If( nSize == nil, nColor, { nColor, nSize } ), @lNewPen )
   if hPen != nil
      hOldPen  := SelectObject( ::hDC, hPen )
   endif
   MoveTo( ::hDC, nLeft, nTop )
   LineTo( ::hDC, nRight, nBottom )
   if hOldPen != nil
      SelectObject( ::hDC, hOldPen )
      if lNewPen
         DeleteObject( hPen )
      endif
   endif
   ::ReleaseDC()

return ni
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby Silvio.Falconi » Fri Nov 19, 2021 11:34 am

But not run ok
for a sample I tried on a dialog
and it not run at @x,y of says

Image

@ 22, 10 SENSITIVE SAY oSay[1] PROMPT "Denominazione" SIZE 100,20 PIXEL OF oFolder:adialogs[1] TRANSPARENT FONT oFontDialog
oSay[1]:lActive := .f.
oSay[1]:lLine :=.t.

any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: say border RESOLVED

Postby cnavarro » Fri Nov 19, 2021 1:18 pm

Try with this

Code: Select all  Expand view

        If ::lLine  //by Silvio
              for n := 1 to len( ::aCaption )
              WSay( ::hWnd, ::hDC, ::nSTop + ( n - 1 ) * ::nTxtHeight * if( ::oWnd:ClassName() = "TDIALOG", 2, 1 ), ::nSLeft, ::aCaption[ n ],;
                    If( ::lOver, ::nClrOver, ::nClrText ),,;
                    If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
                next
 


@ 22, 10 SENSITIVE SAY oSay[1] PROMPT "Denominazione" SIZE 100,20 PIXEL OF oFolder:adialogs[1] TRANSPARENT FONT oFontDialog

Where is the xcommand?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: say border RESOLVED

Postby karinha » Fri Nov 19, 2021 3:45 pm

Sorry, but I don't understand, what's the need to modify a class, to just draw a line? If I understand. If not, my apologies.

https://imgur.com/zFy2rEL

Image

Regards, 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: say border RESOLVED

Postby karinha » Fri Nov 19, 2021 3:48 pm

Code:

Code: Select all  Expand view

// \SAMPLES\RAMONCMB.PRG - 19/11/2021 - kapiabafwh@gmail.com - Yes sir.

#Include "FiveWin.ch"

#Define CLR_PINK       nRGB( 255, 128, 128 )
#Define CLR_NBLUE      nRGB( 128, 128, 192 )
#define CLR_MSPURPLE   nRGB( 0,   120, 215 )
#define CLR_MSRED      nRGB( 232,  17,  35 )
#define CLR_MSGRAY     nRGB( 229, 229, 229 )

FUNCTION Main()

   LOCAL oDlg, oCbx, cTitle, oSayItem, oFnt, oFont, oSayFive, cTextFive
   LOCAL cText := SPACE(200), oTextBras, cTextBras, aGrad, oOk, oExit
   LOCAL SilDrawLi, oSilDrawLi

   cTitle    := "Ramon: DropDown ComboBox"
   cTextFive := "Ramon: DropDown ComboBox - FiveWin"
   cTextBras := "FiveWin Brasil The Best .and. Ramon"
   SilDrawLi := REPLICATE( "_", 20 ) // DrawLine of Silvio

   SET _3DLOOK ON

   SetBalloon( .T. ) // Balloon shape required for tooltips

   SkinButtons()

   aGrad := { { 1, CLR_WHITE, CLR_HCYAN  } }

   DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -28 BOLD
   DEFINE FONT oFnt   NAME "Ms Sans Serif"  SIZE 00, -16 BOLD

   DEFINE DIALOG oDlg TITLE cTitle FROM 110, 1 TO 450, 600 PIXEL        ;
      GRADIENT aGrad

   oDlg:lHelpIcon := .F.

   @ 10, 10 COMBOBOX oCbx VAR cText STYLE CBS_DROPDOWN                  ;
      SIZE 100, 460 OF oDlg PIXEL HEIGHTGET 20 FONT oFnt                ;
      ITEMS { "Ramon Forum ESP", "FiveWin Brasil", "FiveWin Mundial",   ;
              "Corinthians SP ", "Palmeiras SP  ", "Flamengo Rio   ",   ;
              "Marrocos Afrik ", "Brasil Mi Amor", "Estados Unidos ",   ;
              "Canadian Air   ", "Espanha Bella ", "Argentina Enemy"  } ;
      ON CHANGE( oDlg:SetText( cTitle + " - " + cText ),                ;
                 oSayItem:SetText( cText ) )

   oCbx:cToolTip := { || MyToolTip_Cbx( oCbx:nAt, cText ) }

   @ 10, 120 SAY oSayItem VAR cText      SIZE 150, 20 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_PINK, CLR_WHITE TRANSPARENT

   @ 19.00, 120 SAY oSilDrawLi VAR SilDrawLi SIZE 150, 15 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_PINK, CLR_WHITE TRANSPARENT

   @ 40, 120 SAY oSayFive VAR cTextFive  SIZE 150, 50 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_MSPURPLE, CLR_WHITE TRANSPARENT

   @ 60, 120 SAY oSilDrawLi VAR SilDrawLi SIZE 150, 15 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_MSPURPLE, CLR_WHITE TRANSPARENT

   @ 80, 120 SAY oTextBras VAR cTextBras SIZE 150, 50 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_MSRED, CLR_WHITE TRANSPARENT

   @ 104.00, 120 SAY oSilDrawLi VAR SilDrawLi SIZE 150, 15 OF oDlg PIXEL FONT oFont ;
      COLORS CLR_MSRED, CLR_WHITE TRANSPARENT

   @ 145, 100 BUTTON oOk PROMPT "&Ok" SIZE 50, 14 OF oDlg PIXEL ;
      ACTION( oDlg:End() )

   @ 145, 160 BUTTON oExit PROMPT "&Salida" SIZE 50, 14 OF oDlg PIXEL ;
      ACTION( oDlg:End() ) DEFAULT CANCEL

   SET FONT OF oOk   TO oFnt
   SET FONT OF oExit TO oFnt

   ACTIVATE DIALOG oDlg CENTERED

   oFnt:End()
   oFont:End()

RETURN NIL

FUNCTION MyToolTip_Cbx( nOpt, cText )

   LOCAL cRet

   FWLOG nOpt

   IF .NOT. EMPTY( cText ) // vacio no. YES, SIR!!

      Do Case
      Case nOpt = 1
         MsgWait( cText, "Message1",  2 )
      Case nOpt = 2
         MsgWait( cText, "Message2",  2 )
      Case nOpt = 3
         MsgWait( cText, "Message3",  2 )
      Case nOpt = 4
         MsgWait( cText, "Message4",  2 )
      Case nOpt = 5
         MsgWait( cText, "Message5",  2 )
      Case nOpt = 6
         MsgWait( cText, "Message6",  2 )
      Case nOpt = 7
         MsgWait( cText, "Message7",  2 )
      Case nOpt = 8
         MsgWait( cText, "Message8",  2 )
      Case nOpt = 9
         MsgWait( cText, "Message9",  2 )
      Case nOpt = 10
         MsgWait( cText, "Message10", 2 )
      Case nOpt = 11
         MsgWait( cText, "Message11", 2 )
      Case nOpt = 12
         MsgWait( cText, "Message12", 2 )
      EndCase

   ENDIF

RETURN( cRet )

// FIN / END
 
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

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 93 guests