Page 1 of 1

Problem TScrollPanel e TBitmap

PostPosted: Fri Apr 05, 2019 6:36 pm
by oliveiros junior
Hello good afternoon,

I would like to know if anyone has already passed this problem and would know to solve:

In a dialog, I create a TScrollPanel and inside it I put a photo with TBitmap. In the first access everything happens right, however in the second access the following error occurs: Method HBRUSH does not exist.

Thank you for your help.

Att.,

Oliveiros Junior

Re: Problem TScrollPanel e TBitmap

PostPosted: Fri Apr 05, 2019 7:16 pm
by cnavarro
Do not you have a small self-contained example that shows us the problem?

Re: Problem TScrollPanel e TBitmap

PostPosted: Fri Apr 05, 2019 9:46 pm
by oliveiros junior
Olá,

Static Function Editar_Aluno( lAppend )
Local oDialog, aGet[46], aBtn[4], oTitle, oPanel
Local cEscola, nIdade, cFotografia, aAlteracao

cFotografia := oSistema():cLocal_Sistema + "temp\F" + cTempFile() + ".jpg"

DEFINE DIALOG oDialog SIZE 800,600 PIXEL TRUEPIXEL

WITH OBJECT oDialog
:lHelpIcon := .F.
:cTitle := oSistema():cNome_Reduzido_Sistema
:oFont := oSistema():oFonte2
END

// Título
*----------------------------------------------------------------------------*
@ 0,0 TITLE oTitle SIZE 800, 60 TRUEPIXEL OF oDialog ;
SHADOW NOSHADOW ;
COLORBOX nRGB( 107, 141, 184 ), nRGB( 107, 141, 184 ) ;
GRADIENT { nRGB( 107, 141, 184 ), nRGB( 107, 141, 184 ) }

@ 10, 10 TITLETEXT OF oTitle TEXT ".::Aluno" ;
FONT oSistema():oFonte2

@ 30, 10 TITLETEXT OF oTitle TEXT If( lAppend, "Inclusão", "Alteração" ) ;
FONT oSistema():oFonte5

// Paniel
*----------------------------------------------------------------------------*
oPanel := TScrollPanel():New( 70, 0, 550, 800, oDialog, .T. )
oPanel:SetFont( oDialog:oFont )


// Botões
*----------------------------------------------------------------------------*
@ 570,570 BUTTON "&Salvar" SIZE 100, 24 PIXEL OF oDialog ;
ACTION If( Verificar_Aluno( lAppend, aGet, cFotografia, aAlteracao ), ;
oDialog:End(), )

@ 570,680 BUTTON "&Cancelar" SIZE 100, 24 PIXEL OF oDialog ;
ACTION oDialog:End() ;
CANCEL

ACTIVATE DIALOG oDialog CENTERED ;
ON INIT ( Colocar_Controles_Aluno( oPanel, aGet, aBtn, lAppend, cFotografia ), ;
Verificar_Fotografia( lAppend, matricula_aluno, cFotografia, aGet[3] ) )

FErase( cFotografia )
Return NIL
*------------------------------------------------------------------------------*
Static Function Colocar_Controles_Aluno( oPanel, aGet, aBtn, lAppend, cFotografia )
Local nLinha

nLinha := 10

@ nLinha, 580 BITMAP aGet[3] SIZE 120,140 PIXEL OF oPanel FILENAME cFotografia ;
ADJUST

oPanel:SetRange()

Return NIL
*------------------------------------------------------------------------------*

Re: Problem TScrollPanel e TBitmap

PostPosted: Sat Apr 06, 2019 6:32 am
by Silvio.Falconi
a test with TpanelScroll




you must insert


ACTIVATE DIALOG....
ON INIT (oPanel:= CreatePanelScroll(oDlg), oPanel:checkresize() )

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

Function CreatePanelScroll(oWnd)
Local oPanel
oPanel:= TScrollPanel():New(1,1,oWnd:nbottom-10,oWnd:nWidth-10,oWnd, .t.)
oPanel:nRightMargin := 10
oPanel:nBottomMargin := 335

* the gradient not run good when I use scrollbar
* oPanel:Gradient( aGrad )
* oPanel:bResized := { || oPanel:Gradient( aGrad ) }

// oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
oPanel:WinStyle(WS_BORDER, .t.)





For n= 1 to 100
here ...bitmaps or btnbmp
next
oPanel:SetRange()
Return oPanel

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

Re: Problem TScrollPanel e TBitmap

PostPosted: Tue Apr 09, 2019 1:50 am
by oliveiros junior
Hi Silvio, thank you worked the way you indicated.

Thank you Mr. Rao for your attention.

Att.

Oliveiros Junior

Re: Problem TScrollPanel e TBitmap

PostPosted: Tue Apr 09, 2019 3:31 pm
by Marc Venken
Silvio.Falconi wrote:a test with TpanelScroll

Image


you must insert


ACTIVATE DIALOG....
ON INIT (oPanel:= CreatePanelScroll(oDlg), oPanel:checkresize() )

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

Function CreatePanelScroll(oWnd)
Local oPanel
oPanel:= TScrollPanel():New(1,1,oWnd:nbottom-10,oWnd:nWidth-10,oWnd, .t.)
oPanel:nRightMargin := 10
oPanel:nBottomMargin := 335

* the gradient not run good when I use scrollbar
* oPanel:Gradient( aGrad )
* oPanel:bResized := { || oPanel:Gradient( aGrad ) }

// oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
oPanel:WinStyle(WS_BORDER, .t.)





For n= 1 to 100
here ...bitmaps or btnbmp
next
oPanel:SetRange()
Return oPanel

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


Silvio,

How did you make that color selector ? Have you a sample function ?

Marc

Re: Problem TScrollPanel e TBitmap

PostPosted: Wed Apr 10, 2019 7:10 am
by ukoenig
Marc,

For n= 1 to 100
here ...bitmaps or btnbmp
next
oPanel:SetRange()
Return oPanel


For a color-selector I'm using a xBrowse-array.
because NO buttons or images are needed.
You can define any colors You need ( different sets )

Image

I will provide a sample as soon I'm finished
with TGDIPLUS.

regards
Uwe :D

Re: Problem TScrollPanel e TBitmap

PostPosted: Wed Apr 10, 2019 7:22 am
by Silvio.Falconi
I made a my function selector with particular colors set Like office colors no windows colors
for the function I use tscrollpanel and bitmap
I not use fwh color function
Sorry, for now I cannot pubblish..