| Author | Topic: Re: loading BMP from Memofield and show it in XbpBrowse columns ? |
---|
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Sun, 03 Jun 2018 17:31:17 +0800Hi, Diego,
Do you happen to have solution for xbpcolumn heading with text & ico? I
wanted to add to the column heading with a triangle ico after the text to
show the column has the active order.
I have found many of your example in xbpbrowse even with ownerdraw on text
(highlight.prg) but just couldn't figure how to add ico.
Please enlight me
TIA
Paul
On Thu, 25 Aug 2005 16:10:58 +0200, J.A. Diego Kerejeta wrote:
> Regards
>
> Diego |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 00:31:58 +0200Hi,
Two different ways to solve it (You will need to adjust it).
Regards. Diego test.zip |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 18:00:16 +0800Hi Diego,
As always, awesome solution.
However, I have forgot to mention i need to draw the ico/marker after the
xbpcolumn has been created. Meaning when the heading is click the
ico/marker is draw on that heading and the ico/marker on the previous
xbpcolumn heading will be remove.
How do i do that?
TIA
Paul
On Mon, 04 Jun 2018 00:31:58 +0200, Jose Antonio Diego Kereje wrote:
> Hi,
>
> Two different ways to solve it (You will need to adjust it).
>
> Regards. Diego |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 13:10:32 +0200 |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 23:11:33 +0800Hi Diego,
Another brilliant solution. Didnt expect it can be coded this way. But it
laed me to understand more about ownerdraw.
Many thanks again
Paul
On Mon, 04 Jun 2018 13:10:32 +0200, Jose Antonio Diego Kereje wrote:
> Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 23:36:54 +0800Hi Diego,
Just my curiosity, i believe this line remove the previous heading's marker
by redrawing the heading.
_oCol:heading:invalidateRect()
However, which method does it invoke? Because the INLINE METHOD
CustomDrawCell() will definately redraw with marker.
TIA
On Mon, 04 Jun 2018 13:10:32 +0200, Jose Antonio Diego Kereje wrote:
> Regards. Diego |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 18:28:36 +0200Hi Paul,
> Just my curiosity, i believe this line remove the
> previous heading's marker by redrawing the heading.
> _oCol:heading:invalidateRect()
No, just repaint the "old" heading
_oCol:= ::oColOrder
::oColOrder:= oCol This previous line eliminates
it.
_oCol:heading:invalidateRect()
Regards. Diego
PS: I attach the fully functional example. Goodbye test.zip |
| Peter Alderliesten | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 19:40:13 +0200Diego,
> PS: I attach the fully functional example. Goodbye
Very interesting.
I've been reading along as your samples are always worthwhile looking into.
Drawing an arrow with just a few horizontal lines. I would never have
thought that would give such a nice result.
Thanks a lot.
Peter |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Tue, 05 Jun 2018 02:14:37 +0800Yup. I cannot agree with you more. I was originally looking at ico till he
show the example.
On Mon, 4 Jun 2018 19:40:13 +0200, Peter Alderliesten wrote:
> Diego,
>
>> PS: I attach the fully functional example. Goodbye
>
> Very interesting.
> I've been reading along as your samples are always worthwhile looking into.
> Drawing an arrow with just a few horizontal lines. I would never have
> thought that would give such a nice result.
>
> Thanks a lot.
>
> Peter |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 23:42:13 +0200Hi Peter,
Yes, sometimes less is more.
Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Tue, 05 Jun 2018 02:04:59 +0800Hi Diego,
Now i understand how it works. The "old" heading just get repaint with the
field name as caption created earlier. The "new: heading will get an
additional marker paint on it.
The example is getting better & better but i always cant get it to compile
unless i add this line to link xbpbrowse
#pragma Library( "XppUi2.lib" )
Other than that your sample works like a champ even you didnt test it. =
Thank you again
Paul
On Mon, 4 Jun 2018 18:28:36 +0200, Jose Antonio Diego Kereje wrote:
> Hi Paul,
>
>> Just my curiosity, i believe this line remove the
>> previous heading's marker by redrawing the heading.
>
>> _oCol:heading:invalidateRect()
>
> No, just repaint the "old" heading
>
> _oCol:= ::oColOrder
>::oColOrder:= oCol This previous line eliminates
> it.
> _oCol:heading:invalidateRect()
>
> Regards. Diego
>
> PS: I attach the fully functional example. Goodbye |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 04 Jun 2018 23:53:59 +0200Paul,
Although here compiles without problems (w10 & Xbase++ 2.00.951), I added
the pragma directive to the sample.
Regards. Diego test.zip |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Tue, 05 Jun 2018 11:13:53 +0800Hi Diego,
Ok. Tq. We use xbase++ 1.90.355. Maybe thats the different.
Just 1 more question. I use :Enter & :Leave to change the mouse pointer
shape in the heading.
#define XBPSTATIC_SYSICON_UPARROW 10
#define XBPSTATIC_SYSICON_NOT 11
#define XBPSTATIC_SYSICON_APPSTART 12
#define XBPSTATIC_SYSICON_HELP 13
#define XBPSTATIC_SYSICON_PEN 14
#define XBPSTATIC_SYSICON_HAND 15
FUNCTION SetSysPointer( oXbp, nId )
IF nId <= XBPSTATIC_SYSICON_SIZENS
RETURN oXbp:Setpointer( , nId, XBPWINDOW_POINTERTYPE_SYSPOINTER )
ENDIF
IF nId <= 10
nId := 103 + (nId - XBPSTATIC_SYSICON_SIZENS)
ELSE
nId := 108 + (nId - XBPSTATIC_SYSICON_SIZENS)
ENDIF
RETURN oXbp:SetPointer("USER32.DLL", nId, XBPWINDOW_POINTERTYPE_POINTER)
oHead:Enter := {| aPos, uNIL, o | SetSysPointer(o,XBPSTATIC_SYSICON_HAND)}
oHead:Leave := {| uNIL1, uNIL2, o |
SetSysPointer(o,XBPSTATIC_SYSICON_DEFAULT)}
However, sometimes the pointer never change shape when enter from
left/right heading if the size pointer popup. I've check at Alaska website
it seems to be related Pdr 4590 & has not been solved.
Have you encounter this before & any workaround? Maybe the column size can
be fixed so that the size pointer will not show. But how to fix the column
size?
TIA
Paul
On Mon, 04 Jun 2018 23:53:59 +0200, Jose Antonio Diego Kereje wrote:
> Paul,
>
> Although here compiles without problems (w10 & Xbase++ 2.00.951), I added
> the pragma directive to the sample.
>
> Regards. Diego |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Tue, 05 Jun 2018 20:59:59 +0200Hi Paul,
> I use :Enter & :Leave to change the mouse
> pointer shape in the heading.
I would not change the mouse pointer, but if you want to change it...
> However, sometimes the pointer never
> change shape when enter from left/right heading
> if the size pointer popup. I've check at Alaska website
> it seems to be related Pdr 4590 & has not been solved.
> Have you encounter this before & any workaround?
> Maybe the column size can be fixed so that the size
> pointer will not show. But how to fix the column size?
You have to keep in mind that the development of Alaska's guys is special,
sensitive to a small region of the region of the heading, and the assignment
of a new pointer comes into collision with that development. Therefore, if
you want to develop what you want, you have two options:
1. Modify the original Xbase++ code (surely easy if you have it).
2. Use the power of OOP and modify the standard behavior of the XbpColumn
class. In this way, the code will be compatible with future possible changes
of XbpColumn class. That's what I've done in the new sample (You will have
to customize a more appropriate pointer).
Regards. Diego test.zip |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Wed, 06 Jun 2018 13:02:56 +0800Hi Diego,
Once again, you made my day. I will use the 2nd approach, not only to stay
compatible, but to explore more power with OOP.
I like to buy you lunch for the time taken to make the sample. Please email
me your paypal ac.
Regards
Paul
On Tue, 05 Jun 2018 20:59:59 +0200, Jose Antonio Diego Kereje wrote:
> Hi Paul,
>
>> I use :Enter & :Leave to change the mouse
>> pointer shape in the heading.
>
> I would not change the mouse pointer, but if you want to change it...
>
>> However, sometimes the pointer never
>> change shape when enter from left/right heading
>> if the size pointer popup. I've check at Alaska website
>> it seems to be related Pdr 4590 & has not been solved.
>> Have you encounter this before & any workaround?
>> Maybe the column size can be fixed so that the size
>> pointer will not show. But how to fix the column size?
>
> You have to keep in mind that the development of Alaska's guys is special,
> sensitive to a small region of the region of the heading, and the assignment
> of a new pointer comes into collision with that development. Therefore, if
> you want to develop what you want, you have two options:
>
> 1. Modify the original Xbase++ code (surely easy if you have it).
> 2. Use the power of OOP and modify the standard behavior of the XbpColumn
> class. In this way, the code will be compatible with future possible changes
> of XbpColumn class. That's what I've done in the new sample (You will have
> to customize a more appropriate pointer).
>
> Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Wed, 06 Jun 2018 23:33:13 +0800Hi Diego,
i have encountered a problem trying to use the sample. All the text in the
brow data & heading have disappeared. This is 1st step, to subclass &
prepare ownerdraw. If i remove the line ::drawMode:=XBP_DRAW_OWNER at CLASS
tdcCol (2nd last line), brow text is ok.
I have attached the source from both your sample & my code (tdHibrow) for
comparison. For ease of reading, unrelated code is removed & pls ignore the
params.
From the doc -> 'The drawing mode must be assigned to :drawMode before the
method :create() is executed.'. I suppose i have done it right. Is there
something else i have missed?
TIA
Paul
oBrowse := XbpBroTest():new( oParent,, { 0, 0 },,, .F. )
oBrowse:create()
aPP := { { XBP_PP_COL_HA_CAPTION, aStruct[ 1, 1 ] + Space( 10 ) } }
oColumn := XbpColTest():new( oBrowse,,,, aPP )
oColumn:dataLink:= {|x| KK->CAMPO_111 }
oBrowse:addColumn( oColumn )
RETURN oBrowse
CLASS XbpBroTest FROM XbpBrowse
INLINE METHOD Init( oParent, oOwner, aPos, aSize, aPP, lVisible )
::XbpBrowse:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
::drawMode := XBP_DRAW_OWNER
RETURN self
ENDCLASS
CLASS XbpColTest FROM XbpColumn
EXPORTED:
INLINE METHOD Init( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
::XbpColumn:init( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
::drawMode:= XBP_DRAW_OWNER
RETURN self
ENDCLASS
------------------------------------------------------------------------------------------------------------------------
oBrow :=
PwrSchBrow():New(1,1,nRows,nCols,.F.,.F.,.T.,oDa,aFlds,cCompname,aPres)
CLASS PwrSchBrow FROM tdcHiBrow
INLINE METHOD Init(nRow,nCol,nRowHt,nColWd,lJump,lEdit,lShared,,,,)
::tdcHiBrow:init(nRow,nCol,nRowHt,nColWd,lJump,lEdit,lShared,,,,)
RETURN self
ENDCLASS
CLASS tdcHiBrow FROM tdcBrow
METHOD tdcHiBrow:init(nRow,nCol,nRowHt,nColWd,lJump,lEdit,lShared,,,,)
::tdcBrow:init(nRow,nCol,nRowHt,nColWd,oParent,cCompname,aPres,,,,)
::tdcBrow:create()
oCol := tdcCol():new(,,,,aPP,,,self)
oCol:create()
::addColumn(oCol)
RETURN self
ENDCLASS
CLASS tdcBrow FROM XbpBrowse
METHOD tdcBrow:init(nRow,nCol,nRowHt,nColWd,oParent,cCompname,aPres,,,,)
::xbpBrowse:init(oParent,,{nBrowX,nBrowY},{nBrowWd,nBrowHt},aPres,lVisible)
::drawMode := XBP_DRAW_OWNER
RETURN self
ENDCLASS
CLASS tdcCol FROM XbpColumn
METHOD
tdcCol:init(oParent,oOwner,aPos,aSize,aPP,lVisible,cCap2,oBrow,cFtr2)
::XbpColumn:Init(oParent,oOwner,aPos,aSize,aPP,lVisible)
::drawMode := XBP_DRAW_OWNER
RETURN self
ENDCLASS |
| Jim Lee | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Thu, 07 Jun 2018 21:37:37 +0200> i have encountered a problem trying to use the sample. All the text in the
> brow data & heading have disappeared.
where is your CustomDrawCell() ??? |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Fri, 08 Jun 2018 15:36:59 +0800Hi,
Please refer to the sample attacjment from Diego.
However, i have found the problem. Please refer to the following post.
Thank you
Paul
On Thu, 07 Jun 2018 21:37:37 +0200, Jim Lee wrote:
>> i have encountered a problem trying to use the sample. All the text in the
>> brow data & heading have disappeared.
>
> where is your CustomDrawCell() ??? |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Fri, 08 Jun 2018 15:48:20 +0800Hi all,
I have found the where the problem is. There is a method in the tdcBrow
where it process event for mouse wheel.
* For custom mouse wheel handling
METHOD NewBrow:HandleEvent(nEvent,Mp1,Mp2)
IF nEvent == xbeM_Wheel .AND. ::lWheelCtrl
IF Mp2[2] > 0
::up()
ELSE
::down()
ENDIF
::refreshall()
::skipEval()
ELSE
::xbpBrowse:HandleEvent(nEvent,Mp1,Mp2)
ENDIF
RETURN self
*
Its used to skip record by mouse wheel. If this method is remarked, all
captions return to brow. Otherwise captions disappear.
Guess what is the cause of the problem?
TIA
Paul |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Wed, 06 Jun 2018 23:38:52 +0800 |
| Wolfgang Ciriack | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Thu, 07 Jun 2018 08:04:59 +0200Am 06.06.2018 um 17:38 schrieb Paul Chong:
> Screenshots
>
This was a problem with version 2.0.832, it was solved with the newer
versions. |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Thu, 07 Jun 2018 15:24:11 +0800Hi,
I dont think thats the issue cause i can compile his sample with 1.90.355 &
get expected result. Only when i try to add it to my app than the problem
arise. Maybe something to do with my internal code or Topdown code. Still
checking.....
Regards
Paul
On Thu, 7 Jun 2018 08:04:59 +0200, Wolfgang Ciriack wrote:
> Am 06.06.2018 um 17:38 schrieb Paul Chong:
>> Screenshots
>>
> This was a problem with version 2.0.832, it was solved with the newer
> versions. |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 09 Jul 2018 03:02:47 +0800Hello Diego,
Attached your sample and i have added 2 lines of code to make it 2 heading.
Just how not to draw marker on both heading? Let's say only the 2nd heading
will have marker....
TIA
Paul text.zip |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Sun, 08 Jul 2018 22:07:35 +0200INLINE METHOD CustomDrawCell( oPS, aInfo )
******************************************
IF aInfo[ XBP_DRAWINFO_COLUMN ] == ::oColOrder .AND. aInfo[
XBP_DRAWINFO_ITEM ] = 2 .AND. ;
aInfo[ XBP_DRAWINFO_AREA ] = aInfo[ XBP_DRAWINFO_COLUMN ]:heading
oPS:setColor( GRA_CLR_DARKGRAY )
::drawMarker( oPS, { aInfo[ XBP_DRAWINFO_RECT, 3 ] - 8, aInfo[
XBP_DRAWINFO_RECT, 2 ] + 8 } )
ENDIF
RETURN .T.
Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 09 Jul 2018 13:19:08 +0800Hi Diego,
Thank you for being so helpful.
Paul
On Sun, 8 Jul 2018 22:07:35 +0200, Jose Antonio Diego Kereje wrote:
> INLINE METHOD CustomDrawCell( oPS, aInfo )
> ******************************************
> IF aInfo[ XBP_DRAWINFO_COLUMN ] == ::oColOrder .AND. aInfo[
> XBP_DRAWINFO_ITEM ] = 2 .AND. ;
> aInfo[ XBP_DRAWINFO_AREA ] = aInfo[ XBP_DRAWINFO_COLUMN ]:heading
> oPS:setColor( GRA_CLR_DARKGRAY )
> ::drawMarker( oPS, { aInfo[ XBP_DRAWINFO_RECT, 3 ] - 8, aInfo[
> XBP_DRAWINFO_RECT, 2 ] + 8 } )
> ENDIF
> RETURN .T.
>
> Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 09 Jul 2018 16:33:37 +0800Hi Diego,
How to tell if it is a multi-heading? like :maxRow ...
Paul
On Sun, 8 Jul 2018 22:07:35 +0200, Jose Antonio Diego Kereje wrote:
> INLINE METHOD CustomDrawCell( oPS, aInfo )
> ******************************************
> IF aInfo[ XBP_DRAWINFO_COLUMN ] == ::oColOrder .AND. aInfo[
> XBP_DRAWINFO_ITEM ] = 2 .AND. ;
> aInfo[ XBP_DRAWINFO_AREA ] = aInfo[ XBP_DRAWINFO_COLUMN ]:heading
> oPS:setColor( GRA_CLR_DARKGRAY )
> ::drawMarker( oPS, { aInfo[ XBP_DRAWINFO_RECT, 3 ] - 8, aInfo[
> XBP_DRAWINFO_RECT, 2 ] + 8 } )
> ENDIF
> RETURN .T.
>
> Regards. Diego |
| Jose Antonio Diego Kereje | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Mon, 09 Jul 2018 14:09:50 +0200INLINE METHOD CustomDrawCell( oPS, aInfo )
******************************************
IF aInfo[ XBP_DRAWINFO_COLUMN ] == ::oColOrder .AND. aInfo[
XBP_DRAWINFO_AREA ] = aInfo[ XBP_DRAWINFO_COLUMN ]:heading .AND. ;
aInfo[ XBP_DRAWINFO_ITEM ] = aInfo[
XBP_DRAWINFO_COLUMN ]:heading:maxRow
oPS:setColor( GRA_CLR_DARKGRAY )
::drawMarker( oPS, { aInfo[ XBP_DRAWINFO_RECT, 3 ] - 8, aInfo[
XBP_DRAWINFO_RECT, 2 ] + 8 } )
ENDIF
RETURN .T.
Regards. Diego |
| Paul Chong | Re: loading BMP from Memofield and show it in XbpBrowse columns ?
on Tue, 10 Jul 2018 01:52:10 +0800Hi Diego,
Thanks again. It works.
Paul
On Mon, 09 Jul 2018 14:09:50 +0200, Jose Antonio Diego Kereje wrote:
> INLINE METHOD CustomDrawCell( oPS, aInfo )
> ******************************************
> IF aInfo[ XBP_DRAWINFO_COLUMN ] == ::oColOrder .AND. aInfo[
> XBP_DRAWINFO_AREA ] = aInfo[ XBP_DRAWINFO_COLUMN ]:heading .AND. ;
> aInfo[ XBP_DRAWINFO_ITEM ] = aInfo[
> XBP_DRAWINFO_COLUMN ]:heading:maxRow
> oPS:setColor( GRA_CLR_DARKGRAY )
> ::drawMarker( oPS, { aInfo[ XBP_DRAWINFO_RECT, 3 ] - 8, aInfo[
> XBP_DRAWINFO_RECT, 2 ] + 8 } )
> ENDIF
> RETURN .T.
>
> Regards. Diego |