Hi ,
I want to disable menu and other controls on MDI Child window . But this line oWnd:bInit := { || oWnd:oMenu:End() } return error . How to do that with mdi child ? I want to leave only caption and border .
Regards !
#include "fivewin.ch"
STATIC hDC, oWndMain, oWndEdit, oWndBtn, oWndDlg, oFont1
STATIC c_path
FUNCTION MAIN()
LOCAL aColors1,aColors2,aColors3
LOCAL oBtn1, oBtn2, oBtn3, oBtn4
LOCAL oTmp, oBrush1, oBrush2, oBrush3, oBrush4
LOCAL aRect3 := GetSysmetrics( 1 ) // Screen-Height
LOCAL aRect4 := GetSysmetrics( 0 ) // Screen-Width
c_path := CURDRIVE() + ":\" + GETCURDIR()
DEFINE FONT oFont1 NAME "Arial" SIZE 0, -14 BOLD
// ---- MDI - FRAME -----------
// ----------------------------------
DEFINE BRUSH oBrush1 FILENAME "E:\T_SAMPLES\MDI\bitmaps\Back2.jpg"
DEFINE WINDOW oWndMain FROM 1, 1 TO aRect3, aRect4 ;
TITLE "MDI Frame" MDI BRUSH oBrush1 PIXEL
// ----- 1. MDI - CHILD ( normal ) -------
aColors2 := { { 0.5, 128, 65535 }, { 0.5, 65535, 128 } }
DEFINE WINDOW oWndEdit MDICHILD OF oWndMain FROM 50, 550 TO 280, 980 PIXEL ;
TITLE "MDI Child"
@ 20, 50 BTNBMP oBtn1 OF oWndEdit PIXEL ;
SIZE 150 , 60 PROMPT "Hide MDI-buttons" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Hide.bmp" ;
ACTION oWndBtn:Hide()
oBtn1:SetColor( 128, )
oBtn1:cTooltip := { "Hide MDI-buttons" + CRLF + ;
"on MDI-frame","Hide", 1, CLR_BLACK, 14089979 }
@ 100, 50 BTNBMP oBtn2 OF oWndEdit PIXEL ;
SIZE 150 , 60 PROMPT "Show MDI-buttons" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Show.bmp" ;
ACTION oWndBtn:Show()
oBtn2:SetColor( 128, )
oBtn2:cTooltip := { "Show MDI-buttons" + CRLF + ;
"on MDI-frame","Show", 1, CLR_BLACK, 14089979 }
@ 100, 220 BTNBMP oBtn3 OF oWndEdit PIXEL ;
SIZE 150 , 60 PROMPT "Exit" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ;
ACTION oWndMain:End()
oBtn3:SetColor( 128, )
oBtn3:cTooltip := { "Close" + CRLF + ;
"MDI-Test","MDI-Test", 1, CLR_BLACK, 14089979 }
ACTIVATE WINDOW oWndEdit ;
ON PAINT GradientFill( hDC, 0, 0, oWndEdit:nHeight, oWndEdit:nWidth, aColors2, .T. )
// --------- 2. MDI-Child ( hidden with BUTTONS ) ----------
DEFINE BRUSH oBrush4 FILENAME "E:\T_SAMPLES\MDI\bitmaps\Back2A.jpg"
DEFINE WINDOW oWndBtn MDICHILD OF oWndMain FROM 50, 20 TO 350, 190 PIXEL ;
BORDER NONE ;
NOSYSMENU ;
NOICONIZE ;
NOCAPTION ;
BRUSH oBrush4
@ 10, 10 BTNBMP oBtn1 OF oWndBtn PIXEL ;
SIZE 150 , 70 PROMPT "Hide MDI-child" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Hide.bmp" ;
ACTION oWndEdit:Hide()
oBtn1:SetColor( 128, )
oBtn1:cTooltip := { "Hide MDI-Child" + CRLF + ;
"on MDI-frame","Hide MDI-child", 1, CLR_BLACK, 14089979 }
@ 115, 10 BTNBMP oBtn2 OF oWndBtn PIXEL ;
SIZE 150 , 70 PROMPT "Show MDI-child" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Show.bmp" ;
ACTION oWndEdit:Show()
oBtn2:SetColor( 128, )
oBtn2:cTooltip := { "Show MDI-child" + CRLF + ;
"on MDI-frame","Show MDI-child", 1, CLR_BLACK, 14089979 }
@ 220, 10 BTNBMP oBtn3 OF oWndBtn PIXEL ;
SIZE 150 , 70 PROMPT "Exit" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ;
ACTION ( oWndMain:End() )
oBtn3:SetColor( 128, )
oBtn3:cTooltip := { "Exit" + CRLF + ;
"MDI-test","Exit", 1, CLR_BLACK, 14089979 }
ACTIVATE WINDOW oWndBtn
DEFINE BITMAP oAlpha FILENAME c_Path + "\bitmaps\Logo.bmp"
ACTIVATE WINDOW oWndMain MAXIMIZED ;
ON INIT MDI_DIALOG() ;
ON PAINT ABPaint( hDC, 80, 400, oAlpha:hBitmap, 255 ) // Horiz / Vertical
SET MESSAGE OF oWndMain TO FWVERSION + " TechData Software " ;
CENTERED 2007
oFont1:End()
oBrush1:End()
oBrush3:End()
oBrush4:End()
RETURN NIL
// --------- MDI-DIALOG ----------
FUNCTION MDI_DIALOG()
LOCAL hDC, oBtn1
DEFINE DIALOG oWndDlg FROM 500, 555 TO 650, 970 OF oWndMain PIXEL ;
TITLE "Dialog on MDI-Frame"
@ 20, 110 BTNBMP oBtn1 OF oWndDlg ;
SIZE 75 , 35 PROMPT "Exit" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ;
ACTION oWndMain:End()
oBtn1:SetColor( 128, )
oBtn1:cTooltip := { "Close" + CRLF + ;
"MDI-test","Exit", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oWndDlg NOWAIT ;
ON INIT NEW_BRUSH()
RETURN NIL
//------------------------
FUNCTION NEW_BRUSH()
LOCAL hDC1, aColors
aColors := { { 0.5, 128, 65535 }, { 0.5, 65535, 128 } }
hDC1 = CreateCompatibleDC( oWndDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oWndDlg:hDC, oWndDlg:nWidth(), oWndDlg:nHeight() - 25 )
hBmpOld = SelectObject( hDC1, hBmp )
GradientFill( hDC1, 0, 0, oWndDlg:nHeight(), oWndDlg:nWidth(), aColors, .T. )
DeleteObject( oWndEdit:oBrush:hBrush )
oWndDlg:oBrush:hBitmap = hBmp
oWndDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC1, hBmpOld )
oWndDlg:ReleaseDC()
oWndDlg:Refresh()
RETURN NIL
ukoenig wrote:Hello Rimantas,
DEFINE BRUSH oBrush4 FILENAME "E:\T_SAMPLES\MDI\bitmaps\Back2A.jpg"
DEFINE WINDOW oWndBtn MDICHILD OF oWndMain FROM 50, 20 TO 350, 190 PIXEL ;
BORDER NONE ;
NOSYSMENU ;
NOICONIZE ;
NOCAPTION ;
BRUSH oBrush4
Best Regards
Uwe
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 95 guests