Drawing a rectangle around a data field

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
Proman Rodi

Drawing a rectangle around a data field

Post by Proman Rodi » 31 May 2007, 10:50

 Posted by:  Proman Rodi 

Hi, I'm trying to add a solid border to the standard data field border
(here the sample: http://i9.tinypic.com/68cveqa.jpg) and build a new
data field class with "double" border.

Tried to draw the solid border in WM_NCPAINT section but I lost the
original border, any idea or sample?

Thank you in advance

Jarmo Muukka

Re: Drawing a rectangle around a data field

Post by Jarmo Muukka » 31 May 2007, 11:51

 Posted by:  Jarmo Muukka 

Hi,

I would try following:

Code: Select all

On WM_NCPAINT
    Call DefWindowProc( hWndItem, WM_NCPAINT, wParam, lParam )
    Call DrawExtraBorder()    ! in your class or somewhere else or inline
    Return 0
JMu

Proman Rodi

Re: Drawing a rectangle around a data field

Post by Proman Rodi » 31 May 2007, 12:13

 Posted by:  Proman Rodi 

It works (I've used DefWindowProcA instead of DefWindowProc) perfectly!

Thank you Jarmo for the quick reply

Alberto Aviles

Re: Drawing a rectangle around a data field

Post by Alberto Aviles » 01 Jun 2007, 01:14

 Posted by:  Alberto Aviles 

HI Proman Rodi.
could post a sample !!
Thanks

Proman Rodi

Re: Drawing a rectangle around a data field

Post by Proman Rodi » 01 Jun 2007, 11:54

 Posted by:  Proman Rodi 

Attached the sample in TD 3.0

PS 1: I've found a strange behavior of the class when the data field is
hidden by other window and then visible: the repaint function doesn't
paint correctly the original border. Any ideas?

PS 2: how to paint a red solid border around the data field with more
pixel of distance from the original border (a bigger red rectangle)?

Thank you!
You do not have the required permissions to view the files attached to this post.

Proman Rodi

Re: Drawing a rectangle around a data field

Post by Proman Rodi » 01 Jun 2007, 11:57

 Posted by:  Proman Rodi 

It works but I've found a strange behaviour, take a look at the reply
and attached sample given to Mr. Alberto Aviles.

TY

Krzysztof Dorko

Re: Drawing a rectangle around a data field

Post by Krzysztof Dorko » 01 Jun 2007, 15:03

 Posted by:  Krzysztof Dorko 

Hi
Call DefWindowProc( hWndItem, WM_NCPAINT, wParam, lParam ) ????
Why did you use this? (I do not understand this function correctly and all
subclassing but I think there is no reason to use it in this case)
There is a nice post about borders from 5/18/2007 by Christian Astor so
you can follow it.
Comment this line and test it :)
Kris

Proman Rodi

Re: Drawing a rectangle around a data field

Post by Proman Rodi » 01 Jun 2007, 15:27

 Posted by:  Proman Rodi 

Hi, if I comment the line, the default border is not painted :)

czavala
Honduras
Posts: 197
Joined: 02 Oct 2018, 17:35
Location: San Pedro Sula, Honduras

Re: Drawing a rectangle around a data field

Post by czavala » 01 Jun 2007, 15:31

 Posted by:  Conrado ZAVALA 

Hello Proman,

I did a small modification to your program you it gets set on SAM_SetFocus
and gets removed on SAM_KillFocus... this could be used to identify where
you are in a form. I hope you don't mind.

Regards,

Conrado

You do not have the required permissions to view the files attached to this post.

Proman Rodi

Re: Drawing a rectangle around a data field

Post by Proman Rodi » 01 Jun 2007, 15:39

 Posted by:  Proman Rodi 

nice idea, but the strange re-painting problem didn't disappeared :(

you can see the behaviour:
the datafield is created with the correct borders:
http://i18.tinypic.com/62eqb2s.jpg

the form is resized:
http://i13.tinypic.com/6gd55ja.jpg

the form is enlarged but the datafield border is corrupt:
http://i11.tinypic.com/4th4z7l.jpg

thank you

Alberto Aviles

Re: Drawing a rectangle around a data field

Post by Alberto Aviles » 01 Jun 2007, 16:30

 Posted by:  Alberto Aviles 

Thanks Pronan Rodi

Like Krzysztof Dorko say Christian Astor, posts a sample code for make a
color border and too have the same problem, if the border is take back from
another object then don't paint the border again ...

i test an just lost the internal border ( see the attach ), then i thin that
the ploblen maybe are in the order that the object repaint ...
in my case when anoter whindow is over the test window just lost the
internal border..

CTD 3.1 PTF - 4

You do not have the required permissions to view the files attached to this post.

as

Re: Drawing a rectangle around a data field

Post by as » 01 Jun 2007, 16:52

 Posted by:  as 

Try something like that

Code: Select all

frmTest
     On WM_SIZE
              Call SalInvalidateWindow( dfSpecial )

Alberto Aviles

Re: Drawing a rectangle around a data field

Post by Alberto Aviles » 01 Jun 2007, 21:50

 Posted by:  Alberto Aviles 

Conrado Could u post in 3.1
thanks

czavala
Honduras
Posts: 197
Joined: 02 Oct 2018, 17:35
Location: San Pedro Sula, Honduras

Re: Drawing a rectangle around a data field

Post by czavala » 01 Jun 2007, 21:52

 Posted by:  Conrado ZAVALA 

Please try this one.

Conrado

You do not have the required permissions to view the files attached to this post.

czavala
Honduras
Posts: 197
Joined: 02 Oct 2018, 17:35
Location: San Pedro Sula, Honduras

Re: Drawing a rectangle around a data field

Post by czavala » 01 Jun 2007, 22:17

 Posted by:  Conrado ZAVALA 

I beleive this is working fine... look at WM_SIZE under the frmTest

Conrado

You do not have the required permissions to view the files attached to this post.

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests