Problem with Window MDI and dialogs ...bug ?

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Problem with Window MDI and dialogs ...bug ?

Post by Silvio »

I want to show some dialogs into window MDI with style ws_child and NOWAIT

I want show all dialogs pressing the Vscroll of the main window

I not see the dialogs

I see the dialog only if I resize the window why ?
I see the dialog only I no use mdi and vscroll and I can see only the first 4 dialogs

is there a bug ?

look and try this sample test




Code: Select all

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

staTic oWnd,oBar




Function main()
local oBar,oWnd

DEFINE WINDOW oWnd TITLE "DIALOGS generation";
MDI VSCROLL MENU                             ;
BUILDMENU()
*COLOR CLR_WHITE, CLR_WHITE



DEFINE BUTTONBAR oBar 3D SIZE 25, 25 OF oWnd  2007
DEFINE BUTTON OF oBar ACTION CREA()

   SET MESSAGE OF oWnd TO "Testing DIALOGS" ;
      CENTERED CLOCK KEYBOARD 2007
   ACTIVATE WINDOW oWnd MAXIMIZED
return nil


// small menu
FUNCTION BuildMenu()
   local oMenu
   MENU oMenu 2007

      MENUITEM "&File"
         MENU
            MENUITEM i18n( "Printer" ) ;
               ACTION PrinterSetup() ;
               MESSAGE i18n( " Printer setup. " )
            SEPARATOR
            MENUITEM i18n( "Exit" ) ;
              ACTION oWnd:End() ;
               MESSAGE i18n( " Go home. " )
         ENDMENU
   ENDMENU
RETURN oMenu


FUNCTION CREA()

Local nheight := 100
Local nWidth  := 800
Local nLeft   := 20
Local nStyle  := nOR( WS_CHILD,WS_BORDER, 4 )
Local nColor  := SetColor( CLR_RED,CLR_WHITE )
Local n
Local nTotale
Local oFont  := TFont():New(GetSysFont(),0,-18,,.f.,,,,)
Local oDlg:={ }

//I want create the first dialog over the buttonbar

Local nheight_init := oWnd:oBar:nheight



USE DIALOGS ALIAS DIALOGS
INDEX on DIALOGS->NUMBER TO DIALOGS


nTotale:= dialogs->(reccount())
oDlg:=array(nTotale)   // load an array with total of records


n=1

do while !eof()
           
  // create the dialog

     DEFINE DIALOG oDlg[n]

      oDlg[n]:nTop:= nheight_init
      oDlg[n]:nBottom:= nheight
      oDlg[n]:nRight:=nWidth
      oDlg[n]:nLeft := nLeft

     oDlg[n]:nStyle :=nStyle
      oDlg[n]:SetColor( CLR_RED,CLR_WHITE )
     oDlg[n]:cTitle := dialogs->NAME_DLGS

      // now write the number of dialog
      @   nheight_init, nLeft SAY str(recno()) OF oWnd  COLOR CLR_RED,CLR_WHITE FONT oFont

ACTIVATE DIALOG oDlg[n] NOWAIT
        ON INIT oDlg[n]:Move( 20, 20, 50, 50, .T. )

dbskip()

   // now I want move the ntop down the bottom of first dialog
    nheight_init:= nheight_init+2
    nheight := oDlg[n]:nBottom + 100
    n:=n+1

ENDDO




for the dbf you must create a simply dbf name dialogs with these field
NUMBER N 3 0
NAME_DLGS C 10 0




I HOPE YOU FOUND THE ERROR , THANKS
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Antonio,
can you help me plese ?
Best Regards, Saludos

Falconi Silvio
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Post by ShumingWang »

Silvio,
Try to change
While ...
define dialog odlg[n]
enddo

-->
while ...
function definedialogs(odlg[n])
end


function defiendialogs(odlg)

...
return
Best regards!

Shuming Wang
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

sorry THERE WAS AN ERROR
THIS RUN

Code: Select all

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

staTic oWnd,oBar




Function main()
local oBar,oWnd

DEFINE WINDOW oWnd TITLE "DIALOGS generation";
MENU                             ;
BUILDMENU()   ;
 VSCROLL     ;
COLOR CLR_WHITE, CLR_BLUE




DEFINE BUTTONBAR oBar 3D SIZE 25, 25 OF oWnd  2007
DEFINE BUTTON OF oBar ACTION CREA()

   SET MESSAGE OF oWnd TO "Testing DIALOGS" ;
      CENTERED CLOCK KEYBOARD 2007
   ACTIVATE WINDOW oWnd MAXIMIZED
return nil


// small menu
FUNCTION BuildMenu()
   local oMenu
   MENU oMenu 2007

      MENUITEM "&File"
         MENU
            MENUITEM i18n( "Printer" ) ;
               ACTION PrinterSetup() ;
               MESSAGE i18n( " Printer setup. " )
            SEPARATOR
            MENUITEM i18n( "Exit" ) ;
              ACTION oWnd:End() ;
               MESSAGE i18n( " Go home. " )
         ENDMENU
   ENDMENU
RETURN oMenu


FUNCTION CREA()

Local nheight := 100
Local nWidth  := 800
Local nLeft   := 20
Local nStyle  := nOR( WS_CHILD,WS_BORDER, 4 ) 
Local nColor  := SetColor( CLR_RED,CLR_WHITE ) 
Local n 
Local nTotale 
Local oFont  := TFont():New(GetSysFont(),0,-18,,.f.,,,,) 
Local oDlg:={ } 

//I want create the first dialog over the buttonbar 

Local nheight_init := 27



USE DIALOGS ALIAS DIALOGS
INDEX on DIALOGS->NUMBER TO DIALOGS


nTotale:= dialogs->(reccount())
oDlg:=array(nTotale)   // load an array with total of records 


n=1 

do while !eof()
 // create the dialog

     DEFINE DIALOG oDlg[n]

      oDlg[n]:nTop:= nheight_init 
      oDlg[n]:nBottom:= nheight
      oDlg[n]:nRight:=nWidth
      oDlg[n]:nLeft := nLeft

     oDlg[n]:nStyle :=nStyle
      oDlg[n]:SetColor( CLR_RED,CLR_WHITE )
     oDlg[n]:cTitle := dialogs->NAME_DLGS

      // now write the number of dialog
     @   nheight_init, nLeft SAY str(recno()) OF oDlg[n]  COLOR CLR_RED,CLR_RED FONT oFont

      ACTIVATE DIALOG oDlg[n] NOWAIT

dbskip()

   // now I want move the ntop down the bottom of first dialog
    nheight_init:= oDlg[n]:nBottom+5
    nheight := oDlg[n]:nBottom + 100
    n:=n+1

ENDDO

 return nil




buT thE vscroll not run
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

You have to code the behavior that you want for the scrollbar :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Sorry Antonio I try with


ACTIVATE WINDOW oWnd MAXIMIZED ;
ON UP VScroll( GO_UP ) ;
ON DOWN VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE)


Code: Select all

Function VScroll( nType, lPage, nSteps )
DEFAULT lPage := .F.
   if nType == GO_UP

      if oWnd:oVScroll:GetPos() <= oWnd:oVScroll:nMin
         return nil
      endif

       if oWnd:oVScroll:GetPos() > oWnd:oVScroll:nMax
         return nil
      endif
   endif

     if nSteps != nil
      nStep := nSteps
   elseif lPage
      nStep := oWnd:oVScroll:nMax / 10
   else
      nStep := 1
   endif

   if nType == GO_UP
      nStep := -nStep
   elseif nType == GO_POS
      oWnd:oVscroll:SetPos( nSteps )
      nStep := 0
   endif





   return nil






but it not run ok
Best Regards, Saludos

Falconi Silvio
Post Reply