Image button on xbrowse

Image button on xbrowse

Postby Silvio » Tue Mar 09, 2010 8:05 am

I have a clumn of xbrowse with this data .\bitmaps\image1.bmp

and on source code I made :

oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Bitmap} // 60
oCol:cHeader := ""
oCol:nWidth := 80


How I can to show the bitmap ?
and insert on this field a button to select a bitmap or a image a save into this field directly from xbrowse

On xbrimg fwh sample I see two columns on first I can show the image and o the secon I can pick the image
My problem instead is different I want pick an image on the same column I show the bitmap.

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Image button on xbrowse

Postby nageswaragunupudi » Thu Mar 11, 2010 2:17 am

Code: Select all  Expand view
     oCol:bEditValue    := { || ( oBrw:cAlias )->BITMAP }  
      oCol:cDataType     := 'F'
      oCol:bLDClickData  := { || If( ! Empty( cBmp := cGetFile( "(*.bmp)|*.bmp|" ) ), ;
                                   ( oBrw:cAlias )->BITMAP := cBmp, ) }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image button on xbrowse

Postby Silvio » Thu Mar 11, 2010 7:48 am

Error

Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA(8542)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DRAWLINE(1499)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:GOTOP(2665)


this is the code

Code: Select all  Expand view


....

   oApp():oGrid := TXBrowse():New( oApp():oDlg )
   oApp():oGrid:nTop    := 00
   oApp():oGrid:nLeft   := nSplit+2
   oApp():oGrid:nBottom :=  ::nGridBottom
   oApp():oGrid:nRight  :=  ::nGridRight




   oApp():oGrid:nColDividerStyle := LINESTYLE_BLACK
   oApp():oGrid:nRowDividerStyle := LINESTYLE_FORECOLOR
   oApp():oGrid:nMarqueeStyle := MARQSTYLE_HIGHLROW
   oApp():oGrid:lColDividerComplete := .T.
   oApp():oGrid:lRecordSelector := .F.



   oCol:= oApp():oGrid:AddCol()
   oCol:AddResource("sort1")
   oCol:AddResource("sort2")
   oCol:bStrData := { ||  (oDTab)->Concep}  // 6
   oCol:cHeader  := "Codice"
   oCol:nWidth   := 80

   oCol:= oApp():oGrid:AddCol()
   oCol:bStrData := { ||  (oDTab)->Descri}    // 50
   oCol:cHeader  := "Descrizione"
   oCol:nWidth   := 200

   

    oCol:= oApp():oGrid:AddCol()
    oCol:cHeader  := ""
    oCol:bBmpData := { || (oDTab)->Bitmap}
    oCol:nWidth   := 80
    oCol:bEditValue    := { || (oDTab)->BITMAP }
    oCol:cDataType     := 'F'
    oCol:bLDClickData  := { || If( ! Empty( cBmp := cGetFile( "(*.bmp)|*.bmp|" ) ), ;
                                   (oDTab)->BITMAP := cBmp, ) }


          TabAction( norder, oApp:oGrid, aKey,oDTab )



           oApp():oGrid:SetRDD()
           oApp():oGrid:CreateFromCode()
           oApp():oGrid:nRowHeight  :=40
           oApp():oGrid:nHeaderHeight  := 40
           oApp():oGrid:RestoreState( cState )



 ACTIVATE DIALOG oApp():oDlg

 RETURN NIL


static function TabAction( nOption, oGrid, aKey,oDTab )

   FIELD CVETAB

   local cFilter,cKey

   cKey        := aKey[ nOption ]

   cFilter     := "CVETAB = '" + aKey[ nOption ] + "'"

   (oDTab)->( DbSetFilter( &( '{ || ' + cFilter + ' }' ), cFilter ) )
   (oDTab)->( DbGoTop() )


    do case
   case cKey == 'A'
      oApp:oGrid:aCols[3]:lHide   := .t.
       oApp:oGrid:aCols[3]:cHeader:=""
   case cKey == 'T'
      oApp:oGrid:aCols[3]:lHide   := .t.
      oApp:oGrid:aCols[3]:cHeader:=""
   case cKey == 'G'
      oApp:oGrid:aCols[3]:lHide   := .f.
      oApp:oGrid:aCols[3]:cHeader:="Immagine"
   case cKey == 'S'
      oApp:oGrid:aCols[3]:lHide   := .f.
      oApp:oGrid:aCols[3]:cHeader:="Immagine"
   endcase


   if oApp:oGrid:lCreated
      oApp:oGrid:Refresh()
   endif

return nil


 
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Image button on xbrowse

Postby Silvio » Thu Mar 11, 2010 8:10 am

Now I try with

oCol:= oApp():oGrid:AddCol()
oCol:cHeader := ""
oCol:bEditValue := { || (oDTab)->BITMAP }
oCol:cDataType := 'F'
oCol:bLDClickData := { || If( ! Empty( cBmp := cGetFile( "(*.bmp)|*.bmp|" ) ), ;
(oDTab)->BITMAP := cBmp, ) }


Now I see the xbrowse but on this column I cannot see the button

I doubleclick on a record and it select a new bitmap

when I select a new bitmap it make this error

Application
===========
Path and name: C:\work\VDSWIN\VDSWIN.Exe (32 bits)
Size: 3,152,896 bytes
Time from start: 0 hours 0 mins 48 secs
Error occurred at: 11/03/2010, 09:07:53
Error description: Error DBFCDX/1022 Lock required
Args:

Stack Calls
===========
Called from: source\VDS550.PRG => (b)VDS550(123)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:LDBLCLICK(3355)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1469)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10158)
Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(966)
Called from: source\VDSWIN.prg => TAPPLICATION:ACTIVATE(319)
Called from: source\VDSWIN.prg => MAIN(69)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 70 guests