Problem with Window MDI and dialogs ...bug ?

Problem with Window MDI and dialogs ...bug ?

Postby Silvio » Sun May 18, 2008 8:21 pm

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  Expand view  RUN
#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

Postby Silvio » Mon May 19, 2008 3:40 pm

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

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

Postby ShumingWang » Tue May 20, 2008 1:02 am

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

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


function defiendialogs(odlg)

...
return
Best regards!

Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby Silvio » Tue May 20, 2008 9:42 am

sorry THERE WAS AN ERROR
THIS RUN

Code: Select all  Expand view  RUN
#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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Tue May 20, 2008 10:55 am

Silvio,

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

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

Postby Silvio » Tue May 20, 2008 11:51 am

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  Expand view  RUN
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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: dutch and 76 guests