Dialog animated

Dialog animated

Postby Silvio.Falconi » Sat Jan 07, 2017 12:00 pm

We programmers often must enter as many fields in a dialog and space in the dialog is very small.

Certainly we can use the folder but the interface is not very accessible by the end user. A friend sent me this image that was made with a type Tabbed Control Group Custom Header Buttons


Image

someone can understand How make it ?
ps. also nice tgroup class with an small image
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby Antonio Linares » Sun Jan 08, 2017 8:15 am

A new Class TGroupEx or TGroupBmp has to be created.

When the group is closed, its controls are hidden ( oControl:Hide() ) and all the controls
below the group, are moved upwards ( oControl:SetPos( nTop, nLeft ) ).

When it gets opened, all the controls below the group are moved again downwards
( oControl:SetPos( nTop, nLeft ) ) and its controls are shown ( oControl:Show() ).

The group itself does not contain any control. When I say its controls, I mean the
controls whose coordinates are inside the group coordinates.
regards, saludos

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

Re: Dialog animated

Postby Silvio.Falconi » Sun Jan 08, 2017 10:35 am

Can you build it together , I'm afraid I not able , sure !!!
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby joseluisysturiz » Tue Jan 10, 2017 1:58 pm

Es algo parecido a las pestañas de la TExplorer, creo que eso seria una buena idea para hacer dialogos largos en espacios pequeños, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Dialog animated

Postby Antonio Linares » Tue Jan 10, 2017 5:57 pm

> I'm afraid I not able , sure !!!

You will never know it until you try it :-)
regards, saludos

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

Re: Dialog animated

Postby hmpaquito » Tue Jan 10, 2017 8:38 pm

Pues la verdad, no le termino de ver la utilidad a ese "control".

¿ No es mejor un folder o quiza un dialogo / panel con scroll ?

Aparte de para reducir los campos mostrados... que no... no le veo la utilidad.

Queda bonito el hecho que el usuario pueda interactuar con los controles desplegando y recogiendo... pero sólo eso...un poco bonito... que se pasará cuando el usuario lleve un día probando la posible nueva funcionalidad.


Quizá sería interesante si ese mismo dialogo además llevara un scroll :o

En fin, me callo que me estoy liando.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Dialog animated

Postby nageswaragunupudi » Thu Jan 12, 2017 8:15 am

It is a nice animation no doubt.

Utility wise, it does not save even a single line of space. We need to create a dialog which should accommodate all the controls of all the pages. Where is the saving of space?

Whether we scroll (nice to see) or simply hide/reveal it is worth if we can accommodate more controls than the dialog can accommodate. And this can be achieved in many ways already.
Regards

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

Re: Dialog animated

Postby Silvio.Falconi » Thu Jan 12, 2017 9:58 am

I tried to make it
But I not understood How make it

I tried also to make a simulation with a dialog . if it is normal the dialo have a small size and all controls are hide when I click a button the dialog is big
and show the controls but the problem I must make ( I must paint ) a Tgroup not a dialog

My small test
Code: Select all  Expand view


#include "Fivewin.ch"
#include "constant.ch"









 FUNCTION Test()

   LOCAL oDlg
   LOCAL lSave := .F.
   LOCAL oFont
   LOCAL oBtn
   LOCAL oGrp

   LOCAL cCognome
   LOCAL cNome
   LOCAL cGiornoli
   LOCAL cOredispo
   LOCAL cOrecatt

   Local nTipo :=1

   cCognome   := SPACE(10)
   cNome      := SPACE(10)
   cGiornoli  := SPACE(10)
   cOredispo  := SPACE(10)
   cOrecatt   := SPACE(10)


   DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8
   DEFINE DIALOG oDlg FROM 100, 100 TO 734,530;
                 STYLE WS_POPUP;
                 TITLE "Modifica record" PIXEL FONT oFont

   @ 0, 4 GROUP oGrp TO 294, 211 OF oDlg PIXEL
   @ 0, 180  BTNBMP obtn FILENAME "BTN.BMP"   of oDlg size 15,11 NOBORDER PIXEL FONT oFont DEFAULT ACTION Allarga(@ntipo,oDlg,obtn)


   @ 12, 10 SAY "Cognome:" OF oDlg SIZE 31, 8 PIXEL FONT oFont
   @ 10, 50 GET cCognome   OF oDlg SIZE 130, 12 PIXEL FONT oFont

   @ 26, 10 SAY "Nome:" OF oDlg SIZE 20, 8 PIXEL FONT oFont
   @ 24, 50 GET cNome      OF oDlg SIZE 130, 12 PIXEL FONT oFont

   @ 40, 10 SAY "Giornoli:" OF oDlg SIZE 25, 8 PIXEL FONT oFont
   @ 38, 50 GET cGiornoli  OF oDlg SIZE 10, 12 PIXEL FONT oFont

   @ 54, 10 SAY "Oredispo:" OF oDlg SIZE 30, 8 PIXEL FONT oFont
   @ 52, 50 GET cOredispo  OF oDlg SIZE 15, 12 PIXEL FONT oFont

   @ 68, 10 SAY "Orecatt:" OF oDlg SIZE 23, 8 PIXEL FONT oFont
   @ 66, 50 GET cOrecatt   OF oDlg SIZE 15, 12 PIXEL FONT oFont



   @ 298, 4 BUTTON oBtn PROMPT "&Help" OF oDlg SIZE 42, 14 PIXEL FONT oFont // ACTION ()
   @ 298, 125 BUTTON oBtn PROMPT "Conferma" OF oDlg SIZE 42, 14 PIXEL FONT oFont DEFAULT ACTION (oDlg:End(), lSave := .T.)
   @ 298, 169 BUTTON oBtn PROMPT "Annulla" OF oDlg SIZE 42, 14 PIXEL FONT oFont CANCEL ACTION (oDlg:End())

   ACTIVATE DIALOG oDlg CENTERED;
   ON INIT Allarga(ntipo, oDlg,obtn)
   RETURN NIL

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




static Function Allarga(nTipo, oDlg,obtn)
   Local oDlg_Height
   Local nValue
   local ntopDlg:=oDlg:ntop
   local nLeftDlg:= oDlg:nleft
   local  nTop,nLeft




   Do case
   case  nTipo=2
      nValue:= 45.2
      oDlg_Height   :=  nValue * DLG_CHARPIX_H
      /*
        for n=1 to 4
           obtn[n]:nTop = 380
        next
        */

    case  nTipo= 1


      nValue:= 3.1
      oDlg_Height   :=  nValue * DLG_CHARPIX_H
      /*
        for n=1 to 4
           obtn[n]:nTop = 150
        next
       */


    endcase

    sysrefresh()

     iF  nTipo = 1
        nTipo:=2
     ELSE
        nTipo:=1
     ENDIF

   nTop := ( GetSysmetrics( 1 ) - oDlg_Height ) / 2
   nLeft  := ( GetSysmetrics( 0 ) - oDlg:nWidth ) / 2
   oDlg:Move( nTop, nLeft, oDlg:nWidth, oDlg_Height, .f. )

  return nTipo







 
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby Silvio.Falconi » Thu Jan 12, 2017 8:22 pm

nageswaragunupudi wrote:It is a nice animation no doubt.

Utility wise, it does not save even a single line of space. We need to create a dialog which should accommodate all the controls of all the pages. Where is the saving of space?

Whether we scroll (nice to see) or simply hide/reveal it is worth if we can accommodate more controls than the dialog can accommodate. And this can be achieved in many ways already.


for a ssample ? can you please make a small test ?
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby Silvio.Falconi » Thu Jan 12, 2017 9:35 pm

Antonio,
How I can to transform a bitmap into a btnbmp with action ?


Image


the caption not move to left ( +wbmp)


Code: Select all  Expand view

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

#define WM_NCHITTEST     132  // 0x84

#define WM_UPDATEUISTATE 296  // 0x0128

function Main()
local oWnd,o,oFont


DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-14

   DEFINE WINDOW oWnd TITLE "Test"

   o := TGroupBmp():New( 10, 10, 30, 100, "Test TGroupBmp",oWnd)
   o:lTransparent:=.t.
   o:nClrText := CLR_BLACK
   o:nClrPane := CLR_WHITE
   o:cBmp:="fivetech.BMP"

   ACTIVATE WINDOW oWnd

return 0

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

CLASS TGroupBmp FROM TControl

    CLASSDATA lRegistered AS LOGICAL


    DATA lOverClose
    DATA cCaption
    DATA cBmp


    METHOD New( nTop, nLeft, nBottom, nRight, cLabel, oWnd, nClrText, nClrPane,;
            lPixel, lDesign, oFont, lTransparent, nWidth, nHeight,cBmp) CONSTRUCTOR
    METHOD Initiate( hDlg )
    METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint(), 0
    METHOD Paint()
    METHOD LButtonDown( nRow, nCol, nFlags )
    METHOD MouseMove  ( nRow, nCol, nFlags )
    METHOD LButtonUp  ( nRow, nCol, nFlags )
    METHOD EraseBkGnd( hDC ) INLINE 1
    METHOD HandleEvent( nMsg, nWParam, nLParam )

ENDCLASS

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

METHOD New( nTop, nLeft, nBottom, nRight, cLabel, oWnd, nClrText, nClrPane,;
            lPixel, lDesign, oFont, lTransparent, nWidth, nHeight,cBmp)  CLASS TGroupBmp


         DEFAULT nTop     := 0, nLeft := 0, nBottom := 3, nRight := 3,;
           oWnd     := GetWndDefault(),;
           nClrText := oWnd:nClrText, nClrPane := oWnd:nClrPane,;
           lPixel   := .f., lDesign := .f.,;
           lTransparent := .f., oFont := oWnd:oFont



   ::nTop  = nTop  * If( lPixel, 1, GRP_CHARPIX_H ) // 14
   ::nLeft = nLeft * If( lPixel, 1, GRP_CHARPIX_W ) //  7

   if nWidth != nil
      ::nRight = ::nLeft + nWidth
   else
      ::nRight   = nRight  * If( lPixel, 1, GRP_CHARPIX_W ) //  7
   endif

   if nHeight != nil
      ::nBottom = ::nTop + nHeight
   else
      ::nBottom  = nBottom * If( lPixel, 1, GRP_CHARPIX_H ) // 14
   endif

   ::cCaption = cLabel
  * ::cBmp     = cBmp
   ::oWnd     = oWnd
   ::nStyle   = nOR( WS_CHILD, WS_VISIBLE, BS_GROUPBOX,;
                     If( lDesign, nOr( WS_TABSTOP, WS_CLIPSIBLINGS ), 0 ) )
   ::nId      = ::GetNewId()
   ::lUpdate  = .f.
   ::lDrag    = lDesign
   ::lTransparent = lTransparent

   ::SetColor( nClrText, nClrPane )

   if lTransparent
      ::SetBrush( TBrush():New( "NULL" ) )
   endIf

   if ! Empty( oWnd:hWnd )
      ::Create( "BUTTON" )
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif


   if oFont != nil
      ::SetFont( oFont )
   endIf

   if lDesign
      ::CheckDots()
   endif

return Self

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


 METHOD Initiate( hDlg ) CLASS TGroupBmp

   ::Super:Initiate( hDlg )

   if Empty( ::cCaption )
      ::cCaption = ::GetText()
   else
      ::SetText( ::cCaption )
   endif

return nil

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


METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TGroupBmp

   local nResult

   if ::lDrag .and. nMsg == WM_NCHITTEST      // To have a standard behavior on Clicks
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   endif

   if nMsg == WM_UPDATEUISTATE  // Groups and contained controls were erased when pressing ALT
      nResult = ::Super:HandleEvent( nMsg, nWParam, nLParam )
      ::oWnd:Refresh( .f. )  // EMG: added .f. to alleviate flickering
      return nResult
   endif

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


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

METHOD Paint() CLASS TGroupBmp

   local aSize, hOldFont, oFont
   local hBmp,nWBmp,nHBmp
   local hBmpBtnNormal,nWBmpBtnNormal,nHBmpBtnNormal
   local hBmpBtnClosed,nWBmpBtnClosed,nHBmpBtnClosed



   hBmp := ReadBitmap( 0, ::cBmp )
   hBmpBtnNormal :=BmpEBExpanded() //ReadBitmap( 0,  )
   hBmpBtnClosed :=BmpEBCollapsed()




 if hBmp != 0
   nWBmp := nBmpWidth( hBmp )
   nHBmp := nBmpHeight( hBmp )
endif


 if hBmpBtnNormal != 0
   nWBmpBtnNormal := nBmpWidth( hBmpBtnNormal )
   nHBmpBtnNormal := nBmpHeight( hBmpBtnNormal )
endif




CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

     //write Bitmap
      if hBmp != 0
       DrawMasked( ::hDC, hBmp, 0, 6 )
    Endif


   //if Lclosed

     if hBmpBtnNormal != 0
       DrawMasked( ::hDC, hBmpBtnNormal, 9, ::nWidth-20 )
      Endif
    //endif


   //write caption
   if IsAppThemed() .and. ! Empty( ::cCaption )
      oFont = If( ::oFont != nil, ::oFont, ::oWnd:oFont )
      ASize = GetLabelDim( ::hWnd, ::cCaption, oFont:hFont )
      hOldFont = SelectObject( ::hDC, oFont:hFont )
      SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
      FillRect( ::hDC, { 0, 7, aSize[ 2 ] + 6, aSize[ 1 ] + 11 }, ::oBrush:hBrush )
      SetBkMode( ::hDC, 1 )
      TextOut( ::hDC, 0, 9, ::cCaption, Len( ::cCaption ) )
      SelectObject( ::hDC, hOldFont )
   endif


return 0
//--------------------------------------------------------------------------------------------//

METHOD LButtonDown( nRow, nCol, nFlags ) CLASS TGroupBmp
return 0
//--------------------------------------------------------------------------------------------//

METHOD MouseMove  ( nRow, nCol, nFlags ) CLASS TGroupBmp
return 0
//--------------------------------------------------------------------------------------------//

METHOD LButtonUp  ( nRow, nCol, nFlags ) CLASS TGroupBmp
return
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby Antonio Linares » Fri Jan 13, 2017 9:14 am

Silvio,

There is no need to turn them into BtnBmps.

Simply check in METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TGroupBmp if the user clicked on top of them
and then act accordingly

You are doing it very well :-)
regards, saludos

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

Re: Dialog animated

Postby Silvio.Falconi » Fri Jan 13, 2017 10:50 am

Perhaps I understtod but the function Ptinrect need an array
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Dialog animated

Postby Silvio.Falconi » Fri Jan 13, 2017 10:54 am

Antonio
Why not modifiy the explorerbar class ?
Perhaps it seem work good
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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