FabPaintLib and bBrowser
Posted: Sat Sep 03, 2022 10:25 am
Dear all,
I have a bBrowser with a Data Column that displays pictures. In X# the behavior is different than in VO and the picure is not drawn correctly, i.e. partially cut off or scaled weirdly.
To boil down the problem I have adapted Joachim's original example from the bBrowser samples and changed the
bimgCreateBitmapFromDibString() to use FabPaintLib.
Result is, that no image is drawn at all but if I debug the GetImage Function, the object FabImage object seems to be valid.
Does anybody have a similar issue and could resolve it?
An old thread indicated similar problems and that it could be related to bBrowser drawing rather than FabPaintLib:
https://groups.google.com/g/comp.lang.clipper.visual-objects/c/QFn-AI1N950
Best,
Alex
I have a bBrowser with a Data Column that displays pictures. In X# the behavior is different than in VO and the picure is not drawn correctly, i.e. partially cut off or scaled weirdly.
To boil down the problem I have adapted Joachim's original example from the bBrowser samples and changed the
bimgCreateBitmapFromDibString() to use FabPaintLib.
Result is, that no image is drawn at all but if I debug the GetImage Function, the object FabImage object seems to be valid.
Code: Select all
PARTIAL CLASS dtwBitmaps INHERIT _dtwBitmaps
CONSTRUCTOR(oWindow,iCtlID,oServer,uExtra)
SUPER(oWindow,iCtlID,oServer,uExtra)
RETURN
METHOD GetImage_Original(oServer) // original method from Joachim. Works fine.
// Bild aus dem Server ermitteln
LOCAL oImage AS bBitmap
LOCAL cDibData AS STRING
// Bild als String aus dem Server ermitteln
cDibData := oServer:FieldGet(#IMAGE) // stattdessen FieldGet() verwendet, bis der Fehler behoben ist.
IF !Empty(cDibData)
// Bild in ein Bitmap-Objekt konvertieren
oImage := bBitmap{bimgCreateBitmapFromDibString(, cDibData)}
ENDIF
RETURN oImage
METHOD GetImage(oServer) // adapted method, does not yield any picture in the colum. File exists.
LOCAL oFabImage AS FabPaintLib.FabPaintLib
LOCAL cThumbnailName AS STRING
cThumbnailName := "C:temptest.jpg"
IF File(cThumbnailName) //if thumbnail is already there; just take this one
oFabImage := FabPaintLib.FabPaintLib{cThumbnailName, SELF}
ELSE
QOut("Error")
ENDIF
RETURN oFabImage
METHOD PostInit()
// Fenster und Browser initialisieren
LOCAL odbsServer AS OBJECT
LOCAL oColumn AS bDataColumn
LOCAL oFabImage AS FabPaintLib.FabPaintLib
// Fenster initialisieren
SUPER:PostInit()
SetDeleted(TRUE)
// Server IMAGE öffnen
odbsServer := bDBServer{"....DataImage", TRUE, FALSE, "DBFCDX"}
IF odbsServer:Used
// Browser initialisieren
SELF:oDCBrowser:EnableRowHeightVariable(TRUE)
SELF:oDCBrowser:Use(odbsServer,, {#IMAGE_NAME})
// Spalte IMAGE_NAME initialisieren
oColumn := SELF:oDCBrowser:GetColumn(#IMAGE_NAME)
IF oColumn<>NULL_OBJECT
oColumn:Caption := "Name"
ENDIF
// Spalte IMAGE initialisieren
oColumn := bDataColumn{SELF:oDCBrowser, odbsServer, {|Server, Owner| Owner:GetImage(Server)}, #Expression, SELF}
oColumn:Caption := "Image"
oColumn:ValType := "O"
oColumn:Alignment := BALIGN_CENTER
oColumn:Width := 299
SELF:oDCBrowser:AddColumn(oColumn)
SELF:oDCBrowser:OpenColumn(oColumn)
// Browser aktualisieren
SELF:oDCBrowser:Recalculate()
ENDIF
RETURN SELF
END CLASS
An old thread indicated similar problems and that it could be related to bBrowser drawing rather than FabPaintLib:
https://groups.google.com/g/comp.lang.clipper.visual-objects/c/QFn-AI1N950
Best,
Alex