FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem using images in TTitle from RESOURCE ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Problem using images in TTitle from RESOURCE ?
Posted: Mon May 29, 2017 11:03 AM
Hello,

I noticed using images in TTitle from resource is not possible.

From CODE it works.



From RESOURCE

Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = N 20
[ 2] = U

Stack Calls
===========
Called from: .\source\classes\TTITLE.PRG => TTITLE:LOADBITMAPS( 651 )

Using the same like from CODE

@ 20, 20 TITLEIMG OF oTitle BITMAP c_path1 + "info.bmp" ;
SIZE 96, 96 ANIMA;
ACTION oDlgMain:End()


Works from CODE and RESOURCE

@ 25, 150 TITLETEXT oText1 OF oTitle TEXT NIL ;
FONT oLarge ;
SHADOW BOTTOMRIGHT
oText1:Settext( "NO sample" )
oText1:SetColor( 255 ) // red
oTitle:nShadowTxtClr := 12566463
oTitle:nShadowTxtDis := 5 // Shadow Text Distance


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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem using images in TTitle from RESOURCE ? l
Posted: Mon May 29, 2017 11:06 AM

Uwe,

Please check if ::nYOffSetTitle and ::nXOffSetTitle are properly initialized.

Please set them to zero if they are not

Do you have a PRG example ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Problem using images in TTitle from RESOURCE ? l
Posted: Mon May 29, 2017 11:11 AM
Antonio,

the complete test ( works without problem from CODE )

Code (fw): Select all Collapse
FUNCTION RS3_PART4()
LOCAL oBtn1, oTitle, oText1, oText2  

// ------------------ TITLE --------------

REDEFINE TITLE oTitle ID 110 OF oDlgMain BORDER SHADOW BOTTOMRIGHT 
oTitle:lRound := .T.    // Round
oTitle:aGrdBack = { {0.5, 17920, 16777215 }, { 0.5, 16777215, 17920 } }
oTitle:nShadowIntensity := 20
oTitle:lTransparent := .F.

// -------- TEXT ( 2 lines with different colors ) --------------

@ 25, 150 TITLETEXT oText1 OF oTitle TEXT NIL ;
FONT oLarge ;
SHADOW BOTTOMRIGHT 
oText1:Settext( "NO sample" )
oText1:SetColor( 255 ) // red
oTitle:nShadowTxtClr := 12566463
oTitle:nShadowTxtDis := 5     // Shadow Text Distance

@ 75, 150 TITLETEXT oText2 OF oTitle TEXT NIL ;
FONT oLarge ;
SHADOW BOTTOMRIGHT 
oText2:Settext( "defined !!!" )
oText2:SetColor( 6053119 ) // light red
oTitle:nShadowTxtClr := 12566463
oTitle:nShadowTxtDis := 5     // Shadow Text Distance

// ------------------ IMAGE --------------

// Action on full TTitle-area
// It must be a complete transparent image with full ttitle-size. 
// To make it valid, one COLORED pixel on the left upper corner 
// must be defined, otherwise the ttitle-background will be black !!!
// ------------------------------------------------------------------------------
//@ 0, 0 TITLEIMG OF oTitle BITMAP c_path1 + "NIL.bmp" ; 
//SIZE  500, 180 ;
//ACTION oDlgMain:End()

// -- transparent image with action only on image-area
// ------------------------------------------------------------------------
@ 20, 20 TITLEIMG OF oTitle BITMAP c_path1 + "info.bmp" ;
SIZE  96, 96 ANIMA;
ACTION oDlgMain:End()

REDEFINE BTNBMP oBtn1 OF oDlgMain ;
ID 60 PIXEL 2007 ;
BORDER ;
PROMPT " &Exit " ;
FILENAME c_Path1 + "Exit.Bmp" ;
ACTION oDlgMain:End() ;
LEFT
oBtn1 :bClrGrad := { | lMouseOver | If( ! lMouseOver,;
    { { 0.5, 10526975, 16777215 }, ;
      { 0.5, 16777215, 10526975 } }, ;
    { { 0.5, 16768185, 16777215 }, ;
       { 0.5, 16777215, 16768185  } } ) }
oBtn1 :cToolTip =  { "EXIT" + CRLF + "sample","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1 :SetColor( 0, )

RETURN NIL


Using the original sample < testtitlr.prg > adding the image

#include "FiveWin.ch"
#include "ttitle.ch"

function Main()
local oDlg, oTitle, oFont
DEFINE FONT oFOnt NAME "Verdana" SIZE 0, -14
DEFINE DIALOG oDlg RESOURCE 1001
REDEFINE TITLE oTitle ID 222 of oDlg
// oTitle:=.T.
// oTitle:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
@ 25, 25 TITLETEXT OF oTitle TEXT "Prueba" FONT oFont
@ 5, 5 TITLEIMG OF oTitle BITMAP "..\bitmaps\AlphaBmp\explorer.BMP" ;
SIZE 16, 16 ANIMA;
ACTION MsgAlert ( "Button-action" )

ACTIVATE DIALOG oDlg CENTERED
oFont:End()
return nil


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: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Problem using images in TTitle from RESOURCE ?
Posted: Wed Sep 05, 2018 03:44 PM
Hi Antonio,

Any News ? I test it from samples not work.


Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = N 20
[ 2] = U

Stack Calls
===========
Called from: .\source\classes\TTITLE.PRG => TTITLE:LOADBITMAPS( 653 )
Called from: testtitr.prg => MAIN( 30 )


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


function Main()

   local oDlg, oTitle, oFont

   DEFINE FONT oFOnt NAME "標楷體" SIZE 0, 22
 
   DEFINE DIALOG oDlg RESOURCE 1001

   REDEFINE TITLE oTitle ID 222 of oDlg ;
            SHADOWSIZE 0

//    oTitle:=.T.
//    oTitle:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }

   @ 18, 20 TITLETEXT OF oTitle TEXT "離開" FONT oFont

   @ 20, 30 TITLEIMG  OF oTitle BITMAP "../bitmaps\32X32\keys.bmp" SIZE 30, 30 REFLEX ;
            TRANSPARENT ANIMA ACTION MsgInfo( "fire any action from here" )

   ACTIVATE DIALOG oDlg CENTERED
   
   oFont:End()

return nil
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Problem using images in TTitle from RESOURCE ?
Posted: Thu Sep 20, 2018 04:44 AM

Hi Antonio,

Any news for it? This problem long time ago...

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem using images in TTitle from RESOURCE ?
Posted: Sun Sep 23, 2018 06:57 PM
Please use TestTitr.prg, and modify:

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

function Main()

   local oDlg, oTitle, oFont

   DEFINE FONT oFOnt NAME "Verdana" SIZE 0, -14
 
   DEFINE DIALOG oDlg RESOURCE 1001

   REDEFINE TITLE oTitle ID 222 of oDlg

   // oTitle:=.T.
   // oTitle:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }

   ACTIVATE DIALOG oDlg CENTERED ON INIT CreateTitle( oDlg, oTitle, oFont )
   
   oFont:End()

return nil

Function CreateTitle( oDlg, oTitle, oFont )


   @ 25, 25 TITLETEXT OF oTitle TEXT "Prueba" FONT oFont

   @ 5, 5 TITLEIMG OF oTitle BITMAP "..\bitmaps\AlphaBmp\explorer.BMP" ;
     SIZE 16, 16 ANIMA;
     ACTION MsgAlert ( "Button-action" )

Return oTitle

// ----------------------------------------------------------------------------------------------------//


Use this sample with Window and Dialog ( with window not use clause on init, put text and image in Main function and try also )
To be able to place the image, it is necessary that the dialog is completely drawn
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion