strange move Folder - Dialog

strange move Folder - Dialog

Postby Silvio.Falconi » Mon Nov 22, 2021 12:48 pm

a strange thing happens to me

I have a dialog with a folder
depending on whether the user presses a tab the dialgog must change the height ( init 680),

When the user press the tab 3 or tab 6 the dialog must be of 400 height
the other the dialog must be 680 height
I need it because it is possible that in some tabs I do not put some information while in others the information is more than the others
it is possible that in some tabs I do not put some information while in others the information is more than the others

the problem is that when I press a tab the dialog moves up each time
i.e. it does not remain in the initial coordinates i.e. the dialog must always be in one point only the height must change according to the folder tab that is pressed


the sample code
Code: Select all  Expand view

#include "fivewin.ch"


FUNCTION Main()
    local oBrush, oFont
     DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
     DEFINE BRUSH oBrush RESOURCE "background"
   DEFINE WINDOW oWndMain TITLE "Moduli" MDI MENU BuildMenu() VSCROLL HSCROLL BRUSH oBrush
   oWndMain:SetFont( oFont )

   BuildMainBar()

   DEFINE MSGBAR PROMPT "Easyrep app" ;
      OF oWndMain 2015 KEYBOARD DATE


   ACTIVATE WINDOW oWndMain MAXIMIZED

   RELEASE BRUSH oBrush
 Return nil
//-------------------------------------------------------------------------------//
 static function BuildMenu()
 local oMenu

   MENU oMenu

      MENUITEM "Tasks"
      MENU
         MENUITEM "Moduli" ACTION NIL
        MENUITEM "Clients"  ACTION NIL
         MENUITEM "Items"    ACTION NIL
         SEPARATOR
         MENUITEM "Exit" ACTION oWndMain:End()
      ENDMENU

      oMenu:AddMDI()
      oMenu:AddHelp( " app", "(c) FiveTech Software" )

   ENDMENU

   return oMenu
//-------------------------------------------------------------------------------//

static function BuildMainBar()

 *  local oBar

   DEFINE BUTTONBAR oBar OF oWndMain 2013 SIZE 70, 60 //70



   DEFINE BUTTON OF oBar PROMPT "Config" RESOURCE "BTN_CONFIG" ;
       ACTION Config()


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

Function Config()
   local oDlg,oFolder
   local oFontDialog,oFontBold
   local oBarDialog
   local nHeight:= 680

  local aFolder := {"Azienda","Generale","Contabilità","Articoli e Documenti","Vendita touch","Riparazioni"}
   local oIcon

DEFINE FONT oFontDialog NAME 'Tahoma' SIZE 0, -14
DEFINE FONT oFontBold NAME 'Tahoma' SIZE 0, -14  BOLD

DEFINE DIALOG oDlg        ;
   TITLE "Configurazione"    ;
   SIZE  870,nHeight PIXEL TRUEPIXEL               ; //  RESIZABLE
   COLOR CLR_BLACK,  nRgb( 245,244,234)  FONT oFontDialog ICON oIcon

  DEFINE BUTTONBAR oBarDialog OF oDlg SIZE 80, 80  2015   BOTTOM NOBORDER



 @0,0 FOLDEREX oFolder PROMPTS aFolder ;
   SIZE oDlg:nWidth,oDlg:nHeight-oBarDialog:nheight  PIXEL   ;
   FONT oFontDialog  ;
   COLOR nRgb( 245,244,234) ROUND 0


 oFolder:bAction := { || IF(oFolder:nOption=3 .or. oFolder:nOption=6 ,oDlg:nHeight:=400,oDlg:nHeight:=680 ) }



  oDlg:bResized  := <||
              local oRect    := oDlg:GetCliRect()
              oFolder:nTop := oRect:ntop+10
              oFolder:nHeight := oRect:nbottom-90
              oFolder:nWidth  := oRect:nWidth
              oBarDialog:GoDown()
              oBarDialog:refresh()
              return nil
             >

   ACTIVATE DIALOG oDlg CENTERED ;
   ON INIT (  Eval(  oDlg:bResized),;
                oBarDialog:refresh(),;
              Eval(oFolder:baction) )
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: strange move Folder - Dialog

Postby horacio » Mon Nov 22, 2021 2:26 pm

You can use oDlg: Move (nTop, nLeft) to handle that behavior,

Saludos
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: strange move Folder - Dialog

Postby karinha » Mon Nov 22, 2021 2:48 pm

// \samples\CONFIGUR.PRG

Si comprendo, lo haria asi:

Code: Select all  Expand view

#Include "FiveWin.ch"

STATIC oBar
STATIC oWnd
STATIC oDlg

FUNCTION Main()

   LOCAL oBrush, oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 12

   //DEFINE BRUSH oBrush RESOURCE "background"
   DEFINE BRUSH oBrush FILENAME "..\bitmaps\brush1.bmp"

   DEFINE WINDOW oWnd TITLE "Moduli" MDI MENU BuildMenu() ;
      VSCROLL HSCROLL BRUSH oBrush

   oWnd:SetFont( oFont )

   BuildMainBar()

   DEFINE MSGBAR PROMPT "Easyrep app" ;
      OF oWnd 2015 KEYBOARD DATE

   ACTIVATE WINDOW oWnd MAXIMIZED

   RELEASE BRUSH oBrush

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu

   MENUITEM "Tasks"

      MENU

         MENUITEM "Moduli" ACTION NIL
         MENUITEM "Clients"  ACTION NIL
         MENUITEM "Items"    ACTION NIL

         SEPARATOR
         MENUITEM "Exit" ACTION oWnd:End()

      ENDMENU

      oMenu:AddMDI()
      oMenu:AddHelp( " app", "(c) FiveTech Software" )

   ENDMENU

RETURN( oMenu )

FUNCTION BuildMainBar()

   // DEFINE BUTTONBAR oBar OF oWnd 2013 SIZE 70, 60
   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 60 _3DLOOK TOP OF oWnd 2013

   /*
   DEFINE BUTTON OF oBar PROMPT "Config" RESOURCE "BTN_CONFIG" ;
      ACTION Config()
   */

   DEFINE BUTTON OF oBar PROMPT "Config"   ;
      FILENAME "..\bitmaps\16x16\Help.bmp" ;
      ACTION( Config() )

RETURN NIL

FUNCTION Config()

   LOCAL oFld
   LOCAL oFontDialog, oFontBold
   LOCAL oBarDialog
   LOCAL nHeight := 680
   Local nTopR   := 80
   Local nLeftR  := 80
   Local nGris   := nRGB( 25, 25, 25 )

   LOCAL aFolder := { "Azienda", "Generale", "Contabilità", "Articoli e Documenti", "Vendita touch", "Riparazioni" }
   LOCAL oIcon

   DEFINE FONT oFontDialog NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oFontBold   NAME 'Tahoma' SIZE 0, - 14  BOLD

   DEFINE DIALOG oDlg FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80 ;
      TITLE "Configurazione"                                        ;
      SIZE 870, nHeight PIXEL TRUEPIXEL                             ;
      COLORS CLR_WHITE, nGris                                       ;
      FONT oFontDialog ICON oIcon

   oDlg:lHelpIcon := .F.

   DEFINE BUTTONBAR oBarDialog OF oDlg SIZE 80, 80 2015 BOTTOM NOBORDER

   @0, 0 FOLDEREX oFld PROMPTS aFolder                           ;
      SIZE oDlg:nWidth, oDlg:nHeight - oBarDialog:nheight  PIXEL ;
      FONT oFontDialog                                           ;
      COLOR nRgb( 245, 244, 234 ) ROUND 5

   oFld:SetOption( 1 )

   // CREAR_DIALOGO_FLD( oFld, oFld:nOption )
   oFld:bAction := { || CREAR_DIALOGO_FLD( oFld, oFld:nOption ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFontDialog:End()
   oFontBold:End()

RETURN NIL

FUNCTION CREAR_DIALOGO_FLD( oFld, nNOption )

   LOCAL nHeight, nTopR, nLeftR
   LOCAL oFontDialog, oFontBold
   LOCAL nGris   := nRGB( 25, 25, 25 )
   LOCAL oDlg1, oDlg2, oDlg3, oDlg4, oDlg5, oDlg6

   DEFINE FONT oFontDialog NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oFontBold   NAME 'Tahoma' SIZE 0, - 14  BOLD

   IF( nNOption ) = 1

      nHeight := 800
      nTopR   := 400
      nLeftR  := 400

      DEFINE DIALOG oDlg1 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Primera Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg1:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg1 CENTERED NOWAIT

   ELSEIF( nNOption ) = 2

      nHeight := 600
      nTopR   := 150
      nLeftR  := 150

      DEFINE DIALOG oDlg2 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Segunda Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg2:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg2 CENTERED NOWAIT

   ELSEIF( nNOption ) = 3

      nHeight := 400
      nTopR   := 160
      nLeftR  := 160

      DEFINE DIALOG oDlg3 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "tercera Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg3:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg3 CENTERED NOWAIT

   ELSEIF( nNOption ) = 4

      nHeight := 450
      nTopR   := 170
      nLeftR  := 170

      DEFINE DIALOG oDlg4 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Quarta Dialog"                                           ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg4:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg4 CENTERED NOWAIT

   ELSEIF( nNOption ) = 5

      nHeight := 500
      nTopR   := 180
      nLeftR  := 180

      DEFINE DIALOG oDlg5 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Quinta Dialog"                                           ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg5:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg5 CENTERED NOWAIT

   ELSEIF( nNOption ) = 6

      nHeight := 550
      nTopR   := 200
      nLeftR  := 200

      DEFINE DIALOG oDlg6 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "_ Dialog"                                            ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg6:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg6 CENTERED NOWAIT

   ENDIF

   oFontDialog:End()
   oFontBold:End()

RETURN NIL

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

Re: strange move Folder - Dialog

Postby Silvio.Falconi » Tue Nov 23, 2021 8:43 am

karinha wrote:// \samples\CONFIGUR.PRG

Si comprendo, lo haria asi:

Code: Select all  Expand view

#Include "FiveWin.ch"

STATIC oBar
STATIC oWnd
STATIC oDlg

FUNCTION Main()

   LOCAL oBrush, oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 12

   //DEFINE BRUSH oBrush RESOURCE "background"
   DEFINE BRUSH oBrush FILENAME "..\bitmaps\brush1.bmp"

   DEFINE WINDOW oWnd TITLE "Moduli" MDI MENU BuildMenu() ;
      VSCROLL HSCROLL BRUSH oBrush

   oWnd:SetFont( oFont )

   BuildMainBar()

   DEFINE MSGBAR PROMPT "Easyrep app" ;
      OF oWnd 2015 KEYBOARD DATE

   ACTIVATE WINDOW oWnd MAXIMIZED

   RELEASE BRUSH oBrush

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu

   MENUITEM "Tasks"

      MENU

         MENUITEM "Moduli" ACTION NIL
         MENUITEM "Clients"  ACTION NIL
         MENUITEM "Items"    ACTION NIL

         SEPARATOR
         MENUITEM "Exit" ACTION oWnd:End()

      ENDMENU

      oMenu:AddMDI()
      oMenu:AddHelp( " app", "(c) FiveTech Software" )

   ENDMENU

RETURN( oMenu )

FUNCTION BuildMainBar()

   // DEFINE BUTTONBAR oBar OF oWnd 2013 SIZE 70, 60
   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 60 _3DLOOK TOP OF oWnd 2013

   /*
   DEFINE BUTTON OF oBar PROMPT "Config" RESOURCE "BTN_CONFIG" ;
      ACTION Config()
   */

   DEFINE BUTTON OF oBar PROMPT "Config"   ;
      FILENAME "..\bitmaps\16x16\Help.bmp" ;
      ACTION( Config() )

RETURN NIL

FUNCTION Config()

   LOCAL oFld
   LOCAL oFontDialog, oFontBold
   LOCAL oBarDialog
   LOCAL nHeight := 680
   Local nTopR   := 80
   Local nLeftR  := 80
   Local nGris   := nRGB( 25, 25, 25 )

   LOCAL aFolder := { "Azienda", "Generale", "Contabilità", "Articoli e Documenti", "Vendita touch", "Riparazioni" }
   LOCAL oIcon

   DEFINE FONT oFontDialog NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oFontBold   NAME 'Tahoma' SIZE 0, - 14  BOLD

   DEFINE DIALOG oDlg FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80 ;
      TITLE "Configurazione"                                        ;
      SIZE 870, nHeight PIXEL TRUEPIXEL                             ;
      COLORS CLR_WHITE, nGris                                       ;
      FONT oFontDialog ICON oIcon

   oDlg:lHelpIcon := .F.

   DEFINE BUTTONBAR oBarDialog OF oDlg SIZE 80, 80 2015 BOTTOM NOBORDER

   @0, 0 FOLDEREX oFld PROMPTS aFolder                           ;
      SIZE oDlg:nWidth, oDlg:nHeight - oBarDialog:nheight  PIXEL ;
      FONT oFontDialog                                           ;
      COLOR nRgb( 245, 244, 234 ) ROUND 5

   oFld:SetOption( 1 )

   // CREAR_DIALOGO_FLD( oFld, oFld:nOption )
   oFld:bAction := { || CREAR_DIALOGO_FLD( oFld, oFld:nOption ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFontDialog:End()
   oFontBold:End()

RETURN NIL

FUNCTION CREAR_DIALOGO_FLD( oFld, nNOption )

   LOCAL nHeight, nTopR, nLeftR
   LOCAL oFontDialog, oFontBold
   LOCAL nGris   := nRGB( 25, 25, 25 )
   LOCAL oDlg1, oDlg2, oDlg3, oDlg4, oDlg5, oDlg6

   DEFINE FONT oFontDialog NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oFontBold   NAME 'Tahoma' SIZE 0, - 14  BOLD

   IF( nNOption ) = 1

      nHeight := 800
      nTopR   := 400
      nLeftR  := 400

      DEFINE DIALOG oDlg1 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Primera Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg1:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg1 CENTERED NOWAIT

   ELSEIF( nNOption ) = 2

      nHeight := 600
      nTopR   := 150
      nLeftR  := 150

      DEFINE DIALOG oDlg2 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Segunda Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg2:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg2 CENTERED NOWAIT

   ELSEIF( nNOption ) = 3

      nHeight := 400
      nTopR   := 160
      nLeftR  := 160

      DEFINE DIALOG oDlg3 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "tercera Dialog"                                          ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg3:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg3 CENTERED NOWAIT

   ELSEIF( nNOption ) = 4

      nHeight := 450
      nTopR   := 170
      nLeftR  := 170

      DEFINE DIALOG oDlg4 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Quarta Dialog"                                           ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg4:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg4 CENTERED NOWAIT

   ELSEIF( nNOption ) = 5

      nHeight := 500
      nTopR   := 180
      nLeftR  := 180

      DEFINE DIALOG oDlg5 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "Quinta Dialog"                                           ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg5:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg5 CENTERED NOWAIT

   ELSEIF( nNOption ) = 6

      nHeight := 550
      nTopR   := 200
      nLeftR  := 200

      DEFINE DIALOG oDlg6 FROM nTopR, nLeftR TO nTopR + 80, nLeftR + 80  ;
         TITLE "_ Dialog"                                            ;
         SIZE  870, nHeight PIXEL TRUEPIXEL                              ;
         COLORS CLR_WHITE, nGris                                         ;
         FONT oFontDialog

      oDlg6:lHelpIcon := .F.

      ACTIVATE DIALOG oDlg6 CENTERED NOWAIT

   ENDIF

   oFontDialog:End()
   oFontBold:End()

RETURN NIL

// fin / end
 




resolved ( thanks to Rao) with only

local aPt := { 111,200 }

aPt := ClientToScreen( oWndMain:hWnd, aPt )

oFolder:bAction := { || IF(oFolder:nOption=3 .or. oFolder:nOption=6 ,;
(oDlg:nHeight:=400,oDlg:Move( aPt[ 1 ] , aPt[ 2 ] )),;
(oDlg:nHeight:=680,oDlg:Move( aPt[ 1 ] , aPt[ 2 ] )) ) }


Found on another topic
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: strange move Folder - Dialog

Postby karinha » Tue Nov 23, 2021 12:59 pm

Silvio, just curiosity, final code? You can show? If you can't, no problem. Programmer's curiosity only.

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

Re: strange move Folder - Dialog

Postby Silvio.Falconi » Tue Nov 23, 2021 1:05 pm

karinha wrote:Silvio, just curiosity, final code? You can show? If you can't, no problem. Programmer's curiosity only.

Regards, saludos.



local aPt := { 111,200 }

aPt := ClientToScreen( oWndMain:hWnd, aPt )

oFolder:bAction := { || IF(oFolder:nOption=3 .or. oFolder:nOption=6 ,;
(oDlg:nHeight:=400,oDlg:Move( aPt[ 1 ] , aPt[ 2 ] )),;
(oDlg:nHeight:=680,oDlg:Move( aPt[ 1 ] , aPt[ 2 ] )) ) }


ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oDlg:Move( aPt[ 1 ] , aPt[ 2 ] ),;
Eval( oDlg:bResized),;
ChangeButtons(oBarDialog ),;
oBarDialog:refresh(),;
Eval(oFolder:baction) )
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests

cron