Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Additional column data in grid image column 1

Status
Not open for further replies.

coldan

Programmer
Oct 19, 2008
98
AU
I have to click in the vertical scroll bar to remove the erroneous data and leave just the image in there.

See the web page.


Any help appreciated..

Colin
 
I think you need to change the 'sparce' setting for the data in that column.

Good luck

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
No, I don't think it's the Sparse property in this case (but I might be wrong). I suspect it's a quirk in the way that BackStyle_Access works. I've seen this when I've trid to use similar techniques in my own grids.

The solution might be simply to programmatically set focus on the grid. I don't know if that would work in this case, but it's worth a try.

Alternatively, try programmatically scrolling the grid by a small amount (by using the DoScroll method).

By the way, I'd be cautious about creating and deleting directories, and changing the search path, from within the grid. The search path is a global setting, and should not be changed for local needs.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
You don't need to make tricks using backstyle. Instead one of column's Dynamic* property would do (ie: DynamicFontBold is one the easiest):

Thisform.grid1.AddColumn(Thisform.grid1.ColumnCount+1)
with Thisform.grid1.Columns(Thisform.grid1.ColumnCount)

.Name = 'Column20'
.Addobject('image','image')
.Header1.Caption = 'Image'
.DynamicFontBold = '(thisform.UpdateImage('+;
'thisform.Grid1.Column20.Image,EDITING_.THUMB))'
.image.Visible = .T.
.Sparse = .F.
Endwith

* Form custom UpdateImage
lparameter toControl, tcValue
toControl.PictureVal = m.tcValue


Cetin Basoz
MS Foxpro MVP, MCP
 
How do you edit a post here?

In my previous post I forgot to add:

.CurrentControl = 'image'

Cetin Basoz
MS Foxpro MVP, MCP
 
Thanks Mike and Griff.

Changing the sparse stops the image showing.

This app has been in use for many years - the paths that are being changed are in a 3rd party table.

At the start of the prg I have tried this code



ooGsForm1=Newobject("ooGsForm1",'','',myRptForm)
&&doscroll 0 (up),1(down),4(left),5(right)
nDirection=1
ooGsForm1.grid1.DoScroll(nDirection)
nDirection=0
ooGsForm1.grid1.DoScroll(nDirection)
ooGsForm1.grid1.setfocus
ooGsForm1.grid1.Refresh
_Screen.Visible = .T.
ooGsForm1.Show

but the effect is still there - is there a better place for the doscroll?

I tried a setfocus here also but that ruined the size of the grid...sigh<>

Thanks

Colin
 
Cetin

There is no post editing facility at Tek-Tips.

Should you wish to post code snippits, you can wrap the code as described when you click on the 'Process TGML' link lower in the page

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Hmm maybe I should be clearer and supply some code (from your code I think you are storing the images themselves and not the paths):

<pre>
Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
DataSession = 2
Height = 600
Width = 600
cImagePath = _samples+"data\graphics"
Add Object myGrid As Grid ;
with Height = 600, Width = 600, ;
RecordSource="myImageList",ColumnCount=3,RecordSource='crsSample'

Procedure Load
Create Cursor myImageList (ImgFile m NoCPTrans,FileName m)
For ix=1 To Adir(aImageList, Addbs(This.cImagePath)+'*.*')
Insert Into myImageList Values ;
(Filetostr(Addbs(This.cImagePath)+aImageList[ix,1]), aImageList[ix,1])
Endfor
Locate
Select emp.First_Name,emp.Last_name,img.ImgFile ;
FROM (_samples+"data\employee") emp ;
LEFT Join myImageList img ;
ON Upper(Juststem(img.FileName)) == ;
Upper(Left(emp.Last_name,4)+Left(emp.First_Name,4)) ;
INTO Cursor crsSample
Endproc

Procedure myGrid.Init
Local loColumn
This.AddColumn(This.ColumnCount+1)

With This.Columns(This.ColumnCount)
.Name = 'myImgCol'
.AddObject('myImage','Image')
.CurrentControl = 'myImage'
.Sparse = .F.
.myImage.Visible = .T.
.DynamicFontBold = '(thisform.UpdateImage('+;
'thisform.myGrid.myImgCol.myImage,crsSample.imgFile))'
.Width = 180
Endwith
This.RowHeight = 200
Endproc

Procedure UpdateImage
Lparameters toImageCol, tcImage

toImageCol.PictureVal = Nvl(m.tcImage,'')
Endproc
Enddefine
</pre>

Cetin Basoz
MS Foxpro MVP, MCP
 
Colin,

Thank you for a more elegant piece of code.

My app is 4 years old, I have 20 or so prg with the current methodology in them and I can't find the enthusiasm to change them all. <sigh>

I will start with yours in the future

Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top