FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour NOT modify the dialog
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
NOT modify the dialog
Posted: Wed Jul 22, 2009 08:02 PM

I want create a dialog on a window MAIN on a specific point of this window ad with specific sizes

But the final user must not move this dialog and must not size it nevere

How I must make it ?

Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: NOT modify the dialog
Posted: Wed Jul 22, 2009 08:22 PM
Silvio,

It is the Solution I needed for the Buttontools :
I define 2 Dialogs on the Main-Window without the possibility to move or resize them.
( No Title and System-Buttons )

I can put the code here, in case You want to do it this way.
You have to define a Dialog without title, otherwise the user can move the dialog.
A Function, to paint a Title is included.
Please have a look at Antonio's new Topic about Titles.
With the next FWH-release 9.07, You can create a much better looking one.
To make it easy, to use the new class, I will create a Visual-Tool for it, like for the other controls.



Code (fw): Select all Collapse
STATIC FUNCTION TEST_DLG(oWnd)
LOCAL oDlg, oBmp

// Cannot be moved or resized
// ---------------------------------
nDLGStyle = nOR( DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_BORDER )

DEFINE DIALOG oDlg SIZE 200, 300 STYLE nDLGStyle FONT oDlgFont ;
PIXEL TRANSPARENT

// Paint Your own Dialog-Title
// --------------------------------
// use any existing small BMP from Your Resource
// -------------------------------------------------------
@ 0, 0  BITMAP oBmp RESOURCE "EXIT" OF oDlg ;
SIZE 212, 18  PIXEL   ADJUST   NOBORDER
oBMP:cTooltip := "Please select a Button"

// Windows- Dialog-Title Height = 30
// --------------------------------------------
oBMP:bPainted := { |hDC| ;
DRAW_TITLE( oDlg, ;
   oBMP, ;  // BMP
   hDC, ;  // hDC
   .T., ;  // Horiz. or Vert.
   14853684, ;  // 1. Grad-Color
   16314573, ;  // 2. Grad-Color
   0.50, ;  // Color-Pos.
   30, ;  // Text-Pos from left ( 0 = centered )
   oButtFont, ;  // Font
   128, ;  // Font-Color
   "How to Start ...", ;  // Text, ;
   1, ;  // Box-Pen
   128 ) }  // Line-Color Blue = 8388608


// Define Your Dialog-Background on ON PAINT or ON INIT
// -----------------------------------------------------------------

ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT ( oDlg:Move( 110, 460, 430, 215, .f. ) ) ;
ON PAINT ( GradientFill( hDC,  0, 0, oDlg11:nHeight, oDlg11:nWidth, ;
   { { 0.5, 16436128, 16777215  },;
   { 0.5, 16777215, 16436128} }, .F. )

RETURN NIL

//------------- Dialog - Title -----------

FUNCTION DRAW_TITLE( oDlg, oBitmap, hDC, lDirect,nVColor, ;
   nBColor, nMove, nLeft, oFont, nTColor, cTitle, nPen, nPColor ) 
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, oBtn1

DEFINE BRUSH oNewBrush ;
COLOR GradientFill( hDC,  0, 0, aRect[3], aRect[4], aGrad, lDirect )
hOldFont := SelectObject( hDC, oFont:hFont ) 
nTXTLG :=  GettextWidth( hDC, cTitle ) 
nBMPLONG  := oDlg:nWidth() 
nBMPHIGHT := oBitmap:Super:nHeight() 
nFONTHIGHT := oFont:nInpHeight * -1 
IF nLEFT = 0
   nLEFT := (nBMPLONG - nTXTLG) / 2  
ENDIF
nNEWHIGHT := nFONTHIGHT 
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2 
SetTextColor( hDC,nTColor) 
SetBkMode( oBitmap:hDC, 0 ) 
TextOut( hDC, nTOP, nLEFT, cTitle ) 
*oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush

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.

Continue the discussion