Page 1 of 1

Problem using images in TTitle from RESOURCE ?

PostPosted: Mon May 29, 2017 11:03 am
by ukoenig
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 :?:

Re: Problem using images in TTitle from RESOURCE ? l

PostPosted: Mon May 29, 2017 11:06 am
by Antonio Linares
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 ?

Re: Problem using images in TTitle from RESOURCE ? l

PostPosted: Mon May 29, 2017 11:11 am
by ukoenig
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:

Re: Problem using images in TTitle from RESOURCE ?

PostPosted: Wed Sep 05, 2018 3:44 pm
by richard-service
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
 

Re: Problem using images in TTitle from RESOURCE ?

PostPosted: Thu Sep 20, 2018 4:44 am
by richard-service
Hi Antonio,

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

Re: Problem using images in TTitle from RESOURCE ?

PostPosted: Sun Sep 23, 2018 6:57 pm
by cnavarro
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