FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A Possible Extension in Class VTitle FWH 9.07 ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
A Possible Extension in Class VTitle FWH 9.07 ?
Posted: Wed Aug 05, 2009 07:35 PM
Hello,

today I started with FWH 9.07.

I tested the Vtitle-Class.
Is it possible, to add Radio and Checkbox as well like Say and Buttons ?
It works without problems, but I couldn't get it transparent.
Using oTitle:lTransparent := .T., the Title is transparent.
Radio and Checkbox is transparent, but with the Dialog-Gradient.
The Radio and Checkbox belongs to the Dialog. I think, it doesn't work this way,
to get the Gradient-Color from the Title.



Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ttitle.ch"

Function main()
local oDlg, oTitle, oChk, oRadio

lChk := .F.
nValue := 1

aDLG := { { 0.60, 16752190, 16777215 }, ;  
                 { 0.60, 16777215, 16752190 } }    

DEFINE DIALOG oDlg FROM 5, 5 TO 30, 80 TITLE "A Dialog Box"

@ 30, 15  TITLE oTitle size 250, 100 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 2
oTitle:aGrdBack := { { 1, 8553215, 16777215 } }
// Transparent Title
* oTitle:lTransparent := .T.

@ 4.2, 10 CHECKBOX oChk VAR lChk OF oDlg 
oChk:lTransparent := .T.

@ 3.5, 20 RADIO oRadio VAR nValue OF oDlg ;
ITEMS "&One", "&Two", "T&hree" _3D SIZE 100, 16 ;
HELPID 100, 101, 102 ;
ON CHANGE MsgBeep()  

oTitle:nShadowIntensity = 70

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT DLG_GRAD( oDlg, .T. )
 
RETURN NIL

// -------------  DIALOG-GRADIENT   -------

FUNCTION DLG_GRAD( oDlg, lDir)
local hDC, hBmp, hBmpOld, nWidth, nHeight, oBrush

IF Empty( oDlg:oBrush:hBitmap )
      nHeight := if(lDir,oDlg:nHeight,1)
      nWidth  := if(lDir,1,oDlg:nWidth)
       hDC = CreateCompatibleDC( oDlg:GetDC() )
      hBmp = CreateCompatibleBitMap( oDlg:hDC, nWidth, nHeight )
      hBmpOld = SelectObject( hDC, hBmp )
      GradientFill( hDC, 0, 0, nHeight, nWidth, aDLG, lDir )
      DeleteObject( oDlg:oBrush:hBrush )
      oDlg:oBrush:hBitmap = hBmp
      oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
      SelectObject( hDC, hBmpOld )
      oDlg:ReleaseDC()
ENDIF

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: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: A Possible Extension in Class VTitle FWH 9.07 ?
Posted: Thu Aug 06, 2009 12:57 AM

Uwe,

You have defined the controls with the "OF oDlg" clause thus they are inheriting from oDlg. I think you meant to use "OF oTitle."

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A Possible Extension in Class VTitle FWH 9.07 ?
Posted: Thu Aug 06, 2009 01:20 AM
James,

with Title it doesn't work, because Radios and Checkboxes are unknown :

@ 4.2, 10 CHECKBOX oChk VAR lChk OF oTitle // oDlg

Error description: Warning BASE/1004 Message not found: TTITLE:DEFCONTROL
Args:

Stack Calls
===========
Called from: source\rtl\tobject.prg => TTITLE:ERROR(172)
Called from: source\rtl\tobject.prg => TTITLE:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TTITLE:DEFCONTROL(0)
Called from: .\source\classes\CHECKBOX.PRG => TCHECKBOX:NEW(133)
Called from: testtitl.prg => START_DLG(55)
Called from: testtitl.prg => (b)MAIN(25)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(945)
Called from: testtitl.prg => MAIN(25)

Another way :
----------------
nMainStyle = nOR( WS_OVERLAPPED | WS_VISIBLE )
DEFINE DIALOG oDlg FROM 15, 15 TO 250, 500 OF oWnd STYLE nMainStyle PIXEL TRANSPARENT

@ 0, 0 TITLE oTitle size 242, 115 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 2
oTitle:lTransparent := .T.

@ 4.2, 10 CHECKBOX oChk VAR lChk OF oDlg
oChk:lTransparent := .T.

-----------------------------

A Title on Top of a Dialog with the Title-Size ( just a empty Dialog-Frame ).
The Gradient is defined for the Dialog, the Title is transparent.
But to do it this way, You will loose the round Corners of the Title.



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: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: A Possible Extension in Class VTitle FWH 9.07 ?
Posted: Thu Aug 06, 2009 01:27 AM

Ewe,

>Error description: Warning BASE/1004 Message not found: TTITLE:DEFCONTROL

I have not looked at the TTitle class yet, but it seems it was not designed to contain controls.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion