FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error creating a second dialog on center
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Error creating a second dialog on center
Posted: Fri May 22, 2015 08:31 AM
I have A Main oWnd where I call a Dialog ( edit record) on a get open a PopPup where the user can select some procedure. One of this procedure open a second Dialog and i try to show it on center.
on this Dialog there is a combo a 4 buttons:
First option the dialog bottom is 14.1 moving the buttons on top but bottom of combobox
the second option the bottom is 29.2 moving the buttons on bottom.
The function Allarga() change the Size of oDlg.

The error is the dialog is not on the center but on algle top left of Main window ...why ?

ON Windows Xp when the Allarga Function change the size not refresh the dialog and it show the oldest part


the code test
Code (fw): Select all Collapse
#include "Fivewin.ch"
#include "constant.ch"

static oWnd

Function Main()
   Local oWnd
   define window oWnd
   activate window ownd maximized on init  test()
return nil 
//--------------------------------------------------------------------//

function test()

   local oDlg, cMail := Space( 20 )

   DEFINE DIALOG oDlg

   @ 2, 2 GET cMail ACTION ShowMailPopup( oDlg,cMail )

   ACTIVATE DIALOG oDlg CENTERED

return nil
//--------------------------------------------------------------------//
function ShowMailPopup( oDlg,cMail )
   local oMenu
   Local cModello_Generico:= "Spett.le Ambaraba', "+ CRLF+ "Distinti saluti"
   MENU oMenu POPUP
      MENUITEM "Messaggio generico"  ACTION Email(cMail)
     
   ENDMENU
   ACTIVATE POPUP oMenu OF oDlg AT 80, 100
return nil
//--------------------------------------------------------------------//
Function Email(cMail)
   Local  nBottom   := 12// 25
   Local  nRight    :=  58
   Local  nWidth    :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight   :=  nBottom * DLG_CHARPIX_H
   Local aGet[1]
   Local  aItemMail     := {"- Programma di posta predefinito - ","Invio  diretto al server di posta in uscita ( SMTP )"}
 Local  cTipo     := "- Programma di posta predefinito - "
 local obtn[4]
   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -12
   DEFINE FONT oFontBold NAME 'Tahoma' SIZE 0, -18 BOLD

     DEFINE DIALOG oDlgMail          ;
         SIZE nWidth, nHeight   PIXEL  TRUEPIXEL ;
         TITLE "test"
 @ 60,10 COMBOBOX aGet[1] var cTipo ITEMS aItemMail size 214,45  PIXEL of oDlgMail   ;
                        ON CHANGE Allarga(aGet,oDlgMail,obtn)



         @ 190, 10  Button obtn[1] Prompt "&Conferma"        of oDlgMail  size 50,12 PIXEL FONT oFont DEFAULT ACTION ( oDlgMail:end( IDOK ) )
         @ 190, 65  Button obtn[2] Prompt "&e-mail di prova"  of oDlgMail  size 50,12 PIXEL FONT oFont ACTION  NIL
         @ 190, 120 Button obtn[3] Prompt "&Annulla"         of oDlgMail  size 50,12 PIXEL FONT oFont CANCEL ACTION  ( oDlgMail:end( IDCANCEL ) )
         @ 190, 175 Button obtn[4] Prompt "Ai&uto"           of oDlgMail  size 50,12 PIXEL FONT oFont ACTION Helpindex()

 ACTIVATE DIALOG oDlgMail CENTERED ;
              ON INIT ( Allarga(aGet,oDlgMail,obtn))
return nil
//-------------------------------------------------------------------------------------------------//
static Function Allarga(oControl, oDlgMail,obtn)
   Local oDlgMail_Height
   Local nValue
   local nTipo:= oControl[1]:nAt


   Do case
   case  nTipo= 2
      nValue:= 29.2
      oDlgMail_Height   :=  nValue * DLG_CHARPIX_H

        for n=1 to 4
           obtn[n]:nTop = 380
        next


   case   nTipo= 1
      nValue:= 14.1
      oDlgMail_Height   :=  nValue * DLG_CHARPIX_H

        for n=1 to 4
           obtn[n]:nTop = 150
        next


   endcase

   oDlgMail:nBottom := oDlgMail_Height
   oDlgMail:setsize(oDlgMail:nWidth,oDlgMail_Height)
   
   return nil
//------------------------------------------------------------------------------------------------------------//
 Function DlgCenter( oDlg,oWnd )
   oDlg:Center( oWnd )
Return NIL





I tried insert also a Move but then not run ok
oDlgMail:move(200,200,nWidth,nHeight) )


I tried to change allarga() function
with
Code (fw): Select all Collapse
static Function Allarga(oControl, oDlgMail,obtn)
   Local oDlgMail_Height
   Local nValue
   local nTipo:= oControl[1]:nAt
   local ntopDlgMail:=oDlgMail:ntop
   local nLeftDlgMail:= oDlgMail:nleft
    local aClient := GetClientRect (oDlgMail)
   Do case
   case  nTipo= 2
      nValue:= 29.2
      oDlgMail_Height   :=  nValue * DLG_CHARPIX_H

        for n=1 to 4
           obtn[n]:nTop = 380
        next


   case   nTipo= 1
      nValue:= 14.1
      oDlgMail_Height   :=  nValue * DLG_CHARPIX_H

        for n=1 to 4
           obtn[n]:nTop = 150
        next


   endcase

   oDlgMail:nBottom := oDlgMail_Height
   oDlgMail:setsize(oDlgMail:nWidth,oDlgMail_Height)
    oDlgMail:move(aClient[1]+100,aClient[2]+100,oDlgMail:nWidth,oDlgMail_Height)
   return nil


on Windows xp not refresh()
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Error creating a second dialog on center
Posted: Sat May 23, 2015 07:56 AM

any solution please ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Error creating a second dialog on center
Posted: Sun May 24, 2015 03:21 PM
Silvio,

change / add in < Function Allarga(oControl, oDlgMail, obtn) >
..
nTop := ( GetSysmetrics( 1 ) - oDlgMail_Height ) / 2
nLeft := ( GetSysmetrics( 0 ) - oDlgMail:nWidth ) / 2

oDlgMail:Move( nTop, nLeft, oDlgMail:nWidth, oDlgMail_Height, .f. )


//oDlgMail:nBottom := oDlgMail_Height
//oDlgMail:setsize(oDlgMail:nWidth,oDlgMail_Height)


return nil

best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Error creating a second dialog on center
Posted: Sun May 24, 2015 05:20 PM

Uwe,
thanks
on Win seven run ok
on win xp also but when I change the dialog ...for example I select the second option it create the dialog ..then I select the first toption and then not erase the part btoom of the dialog

on win7 i not see this error

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion