Class myColume mit XbpCellGroup()

Grafische Primitive, XbaseParts und Darstellungsfragen allgemein.

Moderator: Moderatoren

Antworten
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12909
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 46 Mal

Class myColume mit XbpCellGroup()

Beitrag von AUGE_OHR »

hi,

hat jemand mit XbpCellGroup() Erfahrung ? Ich will mir damit eine eigene
Class myColume schreiben um damit Bitmaps per Array zu browsen.

Code: Alles auswählen

#define BORDERSIZE 3

CLASS XbpBitmapColumn FROM XbpColumn
   INLINE METHOD create( oParent, oOwner, aPos, aSize, aPP, lVisible )
         ::dataArea:= XbpBitmapCellGroup():new( self, self  )
   RETURN ::XbpColumn:create( oParent, oOwner, aPos, aSize, aPP, lVisible )

CLASS XbpBitmapCellGroup FROM XbpCellGroup
   INLINE METHOD create( oParent, oOwner, aPos, aSize, aPP, lVisible )
      ::XbpCellGroup:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
      ::ClipChildren := .T.
   RETURN self

   INLNE METHOD XbpMemoBitmapCellGroup:creaBmps( nPosStart, nPosEnd )
   LOCAL aPos
   LOCAL aSize
   LOCAL nCont
   LOCAL myPos
   LOCAL mySize := {48,32}

   aPos  := ::cellRect( nPosStart, [lInnerRect] )
   aSize := { aPos[ 3 ] - aPos[ 1 ], aPos[ 4 ] - aPos[ 2 ] }

   myPos := { aPos[1]-(BORDERSIZE)     , aPos[2]+(BORDERSIZE)   ,;
                     aPos[3]+(BORDERSIZE*2), aPos[4]+(BORDERSIZE*2) }

   FOR nCont:= nPosStart TO nPosEnd
*      ::aoBmps[ nCont ] := XbpMemoBitmapStatic():new( self,, ::cellRect( nCont, [lInnerRect] ), aSize )
      ::aoBmps[ nCont ] := XbpMemoBitmapStatic():new( self,, myPos, mySize )
      ::aoBmps[ nCont ]:create()
   NEXT
RETURN self

CLASS XbpBitmapStatic FROM XbpStatic
   INLINE METHOD create( oParent, oOwner, aPos, aSize, aPP, lVisible )
        ::XbpStatic:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
        ::ClipParent   := .T.
        ::type := XBPSTATIC_TYPE_BITMAP
   RETURN self
Das ist jetzt nur das Grundgerüst um zu zeigen was ich will. Mein Problem
ist nun das dass Bitmap, im XbpBitmapStatic(), von der Grösse nicht der
des XbpBitmapCellGroup() entspricht ?

Dazu hab ich mich ::cellRect() bedient welches mir mit .T. die "innen"-
und mit .F. die "aussen"-abmessung geben sollte (Differenz = 1+1+1 ? )

Code: Alles auswählen

oColumn := oBrowse:getColumn(oBrowse:colPos)
aRect := oColumn:dataArea:cellRect( oBrowse:rowPos,[lInnerRect] )
...

aRect  := ::cellRect( nPosStart, .F. )
->
aRect = {0,-6,48,32}          // erste
aRect = {0,137,48,175}      // letzte

aRect  := ::cellRect( nPosStart, .T. )
->
aRect = {3,-3,45,29}
aRect = {0,140,45,172}
warum habe ich "negative" Werte in aRect ?

wenn ich nun die Size aus aRect berechne

Code: Alles auswählen

aSize := {aRect[3]-aRect[1], aRect[4]-aRect[2]}
bekomme ich für :

Code: Alles auswählen

cellRect( nPosStart, .F. ) -> {48-0, 32  -  -6} -> {48,38}
                                {48-0, 175-137} -> {48,38}

cellRect( nPosStart, .T. ) -> {45-3, 29 -  -3} -> {42,32}
                                {45-0,172-140} -> {45,32}   ?!
vorgegeben hatte ich nun {48,32} im Presspace ...

also wie bekomme ich die "0,0" Koordinaten für mein XbpBitmapStatic()
und wie setzte ich ::ClipChildren bzw. ::ClipParent "richtig" damit ich
eine "voll gefüllte" XbpBitmapCellGroup() von {48x32} bekomme ?

gruss by OHR
Jimmy
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12909
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 46 Mal

Beitrag von AUGE_OHR »

hi,

also die Lösung ist jetzt kpl. unter

"public.xbase++.gui" vom 29.04.07 unter "XbpBrowse ´Cell´ without "Frame" ?"

zu finden. Wieder eine geniale Lösung von Diego, aber bei einem
grossen Array viel "paint" Arbeit für Xbase++ ...

gruss by OHR
Jimmy
Antworten