Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Images in grid
Message
From
22/06/2006 12:20:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/06/2006 11:41:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01130802
Message ID:
01130861
Views:
54
>>>Hi All. I have a grid on a form related to a table. I have added an image control to column 1. I have removed the textbox that was in column 1. Each record in the table contains a bmp file name. How do I make the bmp image for each record appear in grid.column1 for each row of the table? I tried the pictureval and picture properties but can't seem to make it work?
>>
>>Images, containers in grid FAQ #7934
>>Cetin
>
>Hi Cetin, I managed to get this to work but I am confused. I tried to just use the DynamicBackColor of the column to set the image picture property but it would not allow that saying that the Image object did not exist as an object of the column although at design time I had added it. It also could not find the .Columns(n) object. Instead I had to create an Init for the grid and set up the column properties in there using your container and image code from the FAQ. When is the .Columns(n) object available? And must one use a container to hold the image?
>
>Thanks anyway!

Hope this explains better:
Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
  DataSession = 2
  Height = 600
  Width = 600
  cImagePath = "graphics"
  Add Object myGrid As Grid ;
    with Height = 600, Width = 600, RecordSource="myImageList",ColumnCount=2

  Procedure Load
    Create Cursor myImageList (FileName m)
    For ix=1 To Adir(aImageList, Addbs(This.cImagePath)+'*.*')
      Insert Into myImageList Values (Fullpath(Addbs(This.cImagePath)+aImageList[ix,1]))
    Endfor
    Locate
  Endproc

  Procedure myGrid.Init
    Local loColumn
    loColumn = This.Columns(This.ColumnCount)
    With loColumn
      .AddObject('myImage','Image')
      .CurrentControl = 'myImage'
      .Sparse = .F.
      .myImage.Visible = .T.
      .DynamicBackColor = 'thisform.fake('+;
        Stuff(Sys(1272,loColumn),1,Len(Sys(1272,This)),'this')+'.myImage)'
      .Width = 90
    Endwith
    This.RowHeight = 100
  Endproc

  Procedure fake
    Lparameters toImage
    toImage.Picture = myImageList.FileName
    Return 0xFFFFFF
  Endproc
Enddefine
One doesn't need to use a container, it was a sample and with a container you have option to put multiple objects there, might have conatiner level code etc.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform