A Possible Extension in Class VTitle FWH 9.07 ?

A Possible Extension in Class VTitle FWH 9.07 ?

Postby ukoenig » Wed Aug 05, 2009 7: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.

Image

Code: Select all  Expand view

#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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A Possible Extension in Class VTitle FWH 9.07 ?

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: A Possible Extension in Class VTitle FWH 9.07 ?

Postby ukoenig » Thu Aug 06, 2009 1: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.

Image

Best Regards
Uwe :lol:
Last edited by ukoenig on Thu Aug 06, 2009 1:37 am, edited 3 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A Possible Extension in Class VTitle FWH 9.07 ?

Postby James Bott » Thu Aug 06, 2009 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 35 guests