>>It still only appears one icon.
>>I've done the following code:
>>
>>if not empty(cursor_frmOrdFabCarteira_Of.IMAGEM)
>> Thisform.GRD1.COLUMN2.IMG1.Picture = cursor_frmOrdFabCarteira_Of.IMAGEM
>>endif
>>Return Thisform.GRD1.COLUMN2.Backcolor
>
>
Ricardo,
>Create a directory and put there a number of image files, then try this (no check if a valid dir is selected, files are imagefiles etc):
>
lcPath = getdir()
>lnFiles = adir(aImageList, lcPath+'*.*')
>Create cursor myImageList (FileName m)
>For ix=1 to alen(aImageList,1)
> Insert into myImageList values (lcPath+aImageList[ix,1])
>Endfor
>Go top
>oForm = createobject('myForm')
>With oForm
> .Lockscreen = .t.
> .Height = 400
> .Width = 600
> .Addobject('myGrid','Grid')
> .Addobject('clbutton','closebutton')
> .clbutton.visible = .t.
> With .myGrid
> .Left = 0
> .Top = 20
> .Height = 370
> .Width = 590
> .Columncount = -1
> .Recordsource = 'myImageList'
> .Columncount = 2
> .RowHeight = .RowHeight * 7
> With .Columns(2)
> .Addobject('myContainer','Container')
> .CurrentControl = 'myContainer'
> .Sparse = .f.
> With .myContainer
> .Addobject('myImage','Image')
> .myImage.Visible = .t.
> Endwith
> .Dynamicbackcolor = 'thisform.fake()'
> Endwith
> .Visible = .t.
> Endwith
> .Lockscreen = .f.
>Endwith
>oForm.Show
>Read events
>
>Define class myForm as Form
> Procedure fake
> Thisform.myGrid.Columns(2).myContainer.myImage.Picture = myImageList.FileName
> Return thisform.myGrid.Backcolor
>Endproc
>Enddefine
>Define class CloseButton as commandbutton
> Height = 15
> Caption ='close'
> Procedure click
> Clear events
> Thisform.release
>Endproc
>Enddefine
>Cetin
Very good trick, Cetin!
You should post this in FAQ section.
I also use similar technic with SQL statements, when UDF returns the same value back, really doing something else.
For example, this sample SQL is doing some maintenance work and immediately writes the changes to the CHNGLOG table.
PRIVATE old_value
UPDATE myTable SET myTable.target_date = REMEMBER_OLD_VALUE(myTable. target_date) , ;
target_date = IIF(change_condition() = .T., GOMONTH(myTable.target_date, 6), target_date) ;
target_date = WRITE_CHANGE(myTable.target_date, "TARGET_DATE") ;
WHERE condition1 = somevalue
where REMEMBER_OLD_VALUE() function stores the old target_date value in
old_value variable, and WRITE_CHANGE() function adds the record to the CHNGLOG with information what table and field were changed, their old and new values, user id, datetime, etc., returning the passed target_date value back.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison