Page 1 of 1

How to use transparent brush on a single folder dialog

Posted: Sat Mar 18, 2006 4:50 pm
by Roger Seiler
I want to use a transparent brush on the dialog of one folder tab in my set of displayed folder dialogs. I've tried without success as follows...

DEFINE BRUSH oBrush FILE "Mypix.bmp"

Then I define the main dialog oDlg, the folder oFld, and then activate the folders and the main dialog oDlg upon which the folders sit...

ACTIVATE DIALOG oDlg ;
NOWAIT

Then I do the following to attempt to load the transparent bitmap...

oFld:aDialogs[1]:lTransparent := .t.
oFld:aDialogs[1]:SetBrush(oBrush)

But this doesn't work - the bitmap is not displayed.

Any suggestions?

- Roger

Posted: Sun Mar 19, 2006 1:46 pm
by Roger Seiler
More info on this...

After updating the dialog's ::lTransparent data and loading the brush into the dialog as shown above, I tried doing oFld:aDialogs[1]:Update() and also oFld:aDialogs[1]:Refresh() and the brush didn't show up.

After doing this, I checked the dialog's data using...

MsgInfo(oFld:aDialogs[1]:lTransparent) -> "T"

and

MsgInfo(oFld:aDialogs[1]:oBrush:cBmpFile) -> "MyPix.bmp"

So the data is getting loaded into the dialog, but the brush still doesn't get displayed. Even using oFld:aDialogs[1]:Display() does nothing here.

Any suggestions, anyone?

- Roger

Posted: Sun Mar 19, 2006 2:55 pm
by Taiwan
Hi, Roger Seiler

Maybe you can use new FWH2.7 support BMP brush for TFolder class.

Regards,

Richard
Fivetech.net Taiwan

Posted: Sun Mar 19, 2006 4:12 pm
by Roger Seiler
Thanks, Richard, for your suggestion.

I AM using FWH 2.7 March 2006, and am using the new brush transparency feature. It works fine on an ordinary dialog, or on the master dialog containing a folder (whereby it flows over all the folders as well). But I can't seem to get it to work only on a particular dialog that is placed on top of a folder. For example, I'd like to use different informative transparent brushes for each folder's dialog.

These brushes are actually pictures of various reports that serve as a background on top of which the user can enter the data that will later appear on the report. My purpose here is to eliminate as much mental abstraction as possible for the users, to make it easier for them to visualize what data they need to enter before the report they want can be printed (using different color codes on overlaid bitmap buttons for data still needed, versus data that has already been supplied).

I think this new transparent brush capability of FWH 2.7 offers an extremely powerful tool for making applications more "user friendly." Just add a little imagination, and the possiblities are limitless. Maybe the next step along this line would be the capability to use a video as a transparent brush. Just imagine what we could do with that as a built-in training tool!

- Roger

Posted: Sun Mar 19, 2006 4:12 pm
by Enrico Maria Giordano
No, it doesn't work with FWH 2.7 too.

EMG

Posted: Sun Mar 19, 2006 4:15 pm
by Roger Seiler
Form-filler software does something similar to what I'm trying to do. You see a picture of the form in the background, on top of which you enter your data.

- Roger

Posted: Sun Mar 19, 2006 4:24 pm
by Enrico Maria Giordano
This is a little sample of the problem. What are we missing?

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrush, oFld

    DEFINE BRUSH oBrush FILE "\fwh\bitmaps\magic.bmp"

    DEFINE DIALOG oDlg;
           RESOURCE "FOLDER"

    REDEFINE FOLDER oFld;
             ID 101 OF oDlg;
             PROMPTS "Test";
             DIALOGS "TEST"

    REDEFINE BUTTON;
             ID 201 OF oDlg;
             ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             ON INIT ( oDlg:SetBrush( oBrush ),;
                       oFld:aDialogs[ 1 ]:SetBrush( oBrush ) );
             CENTER

    RETURN NIL
EMG

Posted: Sun Mar 19, 2006 4:47 pm
by Antonio Linares
Enrico,

Please post the RC of your sample. Thanks,

Posted: Sun Mar 19, 2006 5:07 pm
by Enrico Maria Giordano
Ops. Here it is:

Code: Select all

/****************************************************************************


peppe.rc

produced by Borland Resource Workshop


*****************************************************************************/


FOLDER DIALOG 49, 52, 365, 295
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Folder test"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "", 101, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE, 5, 5, 355, 265
 CONTROL "&Close", 201, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 275, 40, 15
}


TEST DIALOG 49, 52, 365, 295
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "Test", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 10, 15, 20, 10
}


1 24 LOADONCALL MOVEABLE 
{
 '3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31'
 '2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 55 54'
 '46 2D 38 22 20 73 74 61 6E 64 61 6C 6F 6E 65 3D'
 '22 79 65 73 22 3F 3E 0D 0A 3C 61 73 73 65 6D 62'
 '6C 79 20 78 6D 6C 6E 73 3D 22 75 72 6E 3A 73 63'
 '68 65 6D 61 73 2D 6D 69 63 72 6F 73 6F 66 74 2D'
 '63 6F 6D 3A 61 73 6D 2E 76 31 22 0D 0A 6D 61 6E'
 '69 66 65 73 74 56 65 72 73 69 6F 6E 3D 22 31 2E'
 '30 22 3E 0D 0A 3C 61 73 73 65 6D 62 6C 79 49 64'
 '65 6E 74 69 74 79 0D 0A 20 20 20 20 6E 61 6D 65'
 '3D 22 59 6F 75 72 2E 41 70 70 6C 69 63 61 74 69'
 '6F 6E 2E 4E 61 6D 65 2E 48 65 72 65 22 0D 0A 20'
 '20 20 20 70 72 6F 63 65 73 73 6F 72 41 72 63 68'
 '69 74 65 63 74 75 72 65 3D 22 78 38 36 22 0D 0A'
 '20 20 20 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30'
 '2E 30 2E 30 22 0D 0A 20 20 20 20 74 79 70 65 3D'
 '22 77 69 6E 33 32 22 2F 3E 0D 0A 3C 64 65 73 63'
 '72 69 70 74 69 6F 6E 3E 57 69 6E 64 6F 77 73 20'
 '53 68 65 6C 6C 3C 2F 64 65 73 63 72 69 70 74 69'
 '6F 6E 3E 0D 0A 3C 64 65 70 65 6E 64 65 6E 63 79'
 '3E 0D 0A 20 20 20 20 3C 64 65 70 65 6E 64 65 6E'
 '74 41 73 73 65 6D 62 6C 79 3E 0D 0A 20 20 20 20'
 '20 20 20 20 3C 61 73 73 65 6D 62 6C 79 49 64 65'
 '6E 74 69 74 79 0D 0A 20 20 20 20 20 20 20 20 20'
 '20 20 20 74 79 70 65 3D 22 77 69 6E 33 32 22 0D'
 '0A 20 20 20 20 20 20 20 20 20 20 20 20 6E 61 6D'
 '65 3D 22 4D 69 63 72 6F 73 6F 66 74 2E 57 69 6E'
 '64 6F 77 73 2E 43 6F 6D 6D 6F 6E 2D 43 6F 6E 74'
 '72 6F 6C 73 22 0D 0A 20 20 20 20 20 20 20 20 20'
 '20 20 20 76 65 72 73 69 6F 6E 3D 22 36 2E 30 2E'
 '30 2E 30 22 0D 0A 20 20 20 20 20 20 20 20 20 20'
 '20 20 70 72 6F 63 65 73 73 6F 72 41 72 63 68 69'
 '74 65 63 74 75 72 65 3D 22 78 38 36 22 0D 0A 20'
 '20 20 20 20 20 20 20 20 20 20 20 70 75 62 6C 69'
 '63 4B 65 79 54 6F 6B 65 6E 3D 22 36 35 39 35 62'
 '36 34 31 34 34 63 63 66 31 64 66 22 0D 0A 20 20'
 '20 20 20 20 20 20 20 20 20 20 6C 61 6E 67 75 61'
 '67 65 3D 22 2A 22 0D 0A 20 20 20 20 20 20 20 20'
 '2F 3E 0D 0A 20 20 20 20 3C 2F 64 65 70 65 6E 64'
 '65 6E 74 41 73 73 65 6D 62 6C 79 3E 0D 0A 3C 2F'
 '64 65 70 65 6E 64 65 6E 63 79 3E 0D 0A 3C 2F 61'
 '73 73 65 6D 62 6C 79 3E'
}
EMG

Posted: Sun Mar 19, 2006 5:26 pm
by Roger Seiler
Enrico,

In your example, I think your ACTIVATE DIALOG needs one more thing to set the dialog's ::lTransparent to .t. ...

ACTIVATE DIALOG oDlg;
ON INIT ( oDlg:SetBrush( oBrush ),;
oFld:aDialogs[ 1 ]:lTransparent := .t. ;
oFld:aDialogs[ 1 ]:SetBrush( oBrush ) );
CENTER

However, though it is logical that this is needed, it still doesn't solve the problem.

- Roger

Posted: Sun Mar 19, 2006 7:45 pm
by Antonio Linares
Roger, Enrico,

Here it works ok with this little change:

Code: Select all

    ACTIVATE DIALOG oDlg; 
             ON INIT ( oDlg:SetBrush( oBrush ),;
                       oFld:aDialogs[ 1 ]:bEraseBkgnd := nil,; 
                       oFld:aDialogs[ 1 ]:SetBrush( oBrush ) ); 
             CENTER 
Image

Posted: Sun Mar 19, 2006 10:28 pm
by Roger Seiler
Hooray! That did the trick!

You've earned a Cuban cigar, Antonio. The next time I see Fidel, I'll get you one. ;-)

- Roger

Posted: Sun Mar 19, 2006 10:32 pm
by Enrico Maria Giordano
Great!

EMG

Posted: Tue Mar 21, 2006 12:00 am
by reinaldocrespo
By God, Antonio!

I'd like to meet that woman!

:-)


Reinaldo.