Page 1 of 1

bitmap for nEditType EDIT_BUTTON

Posted: Wed Sep 28, 2022 8:27 am
by Detlef
I want to exchange the bitmap which is shown when I have a xBrowse column with nEditType EDIT_BUTTON.
My try was

Code: Select all | Expand

WITH OBJECT oBrw:aCols[ 1 ]
      :oBtnElip:SetText( "" )
      :oBtnElip:LoadBitmaps( "find16" )
      :nEditType  := EDIT_BUTTON
      :bEditBlock := { | nRow, nCol, oCol, nKey | dGetCal( oCol ) }
   END

But this gives me the error that oBrw:aCol[1]:oBtnElip is NIL.

I can't find out what I'm doing wrong.
Has anyone an idea?
Thanks, Detlef

Re: bitmap for nEditType EDIT_BUTTON

Posted: Wed Sep 28, 2022 8:54 am
by Antonio Linares
Dear Detlef,

A possible suggestion is that the xbrowse is not built yet.

Once created, then you will be able to modify those properties

Just guessing...

Re: bitmap for nEditType EDIT_BUTTON

Posted: Wed Sep 28, 2022 9:57 am
by Detlef
Dear Antonio,

as usual you guessed right. :D
I had to put my code into the ON INIT clause of the dialog and then it works.

Many thanks
Detlef

Re: bitmap for nEditType EDIT_BUTTON

Posted: Wed Sep 28, 2022 1:53 pm
by Antonio Linares
very good :-)

Re: bitmap for nEditType EDIT_BUTTON

Posted: Wed Sep 28, 2022 5:25 pm
by nageswaragunupudi
Recommended way:

Code: Select all | Expand

function somename()

   local oDlg, oBrw

   USE STATES

   DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL RESIZABLE

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" ;
      COLUMNS "Code", "Name" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      WITH OBJECT :aCols[ 2 ]
         :nEditType  := EDIT_BUTTON
         :nBtnBmp    := :AddBitmap( "EDIT" )
         :bEditBlock := { | nRow, nCol, oCol, nKey | MsgInfo( "edit" ), nil }
      END
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil
 

Syntax
oCol:AddBitmap( uImage, [aResize] ) --> nBmpSerialNumber
uImage can be bmpfile, anyimage file, resource,anyimagebuf, etc.
aResize Optionally resize {w,h}