Problem using images in TTitle from RESOURCE ?

Problem using images in TTitle from RESOURCE ?

Postby ukoenig » Mon May 29, 2017 11:03 am

Hello,

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

From CODE it works.

Image

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 :?:
Last edited by ukoenig on Mon May 29, 2017 11:15 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: Problem using images in TTitle from RESOURCE ? l

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41365
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem using images in TTitle from RESOURCE ? l

Postby ukoenig » Mon May 29, 2017 11:11 am

Antonio,

the complete test ( works without problem from CODE )

Code: Select all  Expand view

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:lBorder:=.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 :roll:
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: Problem using images in TTitle from RESOURCE ?

Postby richard-service » Wed Sep 05, 2018 3: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: Select all  Expand view

#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:lBorder:=.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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 771
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Problem using images in TTitle from RESOURCE ?

Postby richard-service » Thu Sep 20, 2018 4:44 am

Hi Antonio,

Any news for it? This problem long time ago...
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 771
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Problem using images in TTitle from RESOURCE ?

Postby cnavarro » Sun Sep 23, 2018 6:57 pm

Please use TestTitr.prg, and modify:

Code: Select all  Expand view

#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:lBorder:=.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
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

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