1

Konu: Küçük bir yardım

Sevgili dostlar merhaba.

Aşağıda çok basit bir kod var ve çalışıyor. Ben bunu direkt olarak bir formun içine monte etmek istiyorum.
Grid tamam. load, activate falan tamam. hepsini yerli yerine yerleştirdim. Ama

    Procedure ShowPicture(ImageObject, empcode)
    ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif" 
    Endproc

formda nereye yerleştirmem gerektiğini bulamadım. Bu konuda yardımcı olursanız sevinirim.
Şimdiden teşekkür ederim. Selamlar.

***

Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
    Height = 580
    Width = 600
    AutoCenter = .T.
    Caption = 'Various Images on Grid - Part II'
    ImgPath = _samples+"data\Graphics"

    Add Object Grid1 As Grid WITH ;
        Height = 570, Width = 590, RecordSource="junk",;
        ColumnCount=3, DeleteMark = .F., RowHeight = 180

    Procedure Load
    Set Talk Off
    Set Safety Off

    Select Left(last_name,4)+Left(first_name,4) As empcode, first_name, last_name  From (_samples+"data\employee") ;
        INTO Cursor junk NOFILTER
    Endproc

    Procedure Grid1.Init
    With This.column1 As Column
        .AddObject('myImage','Image')
        .CurrentControl = 'myImage'
        .myImage.Visible = .T.
        .DynamicFontBold = 'thisform.ShowPicture(this.column1.myImage,junk.empcode)'
        .Width = 500
        .Sparse = .F.
        .ReadOnly=.T.
    Endwith
    Endproc

   Procedure Grid1.AfterRowColChange
    Lparameters nColIndex
    * Because this involves getting actual outside images, 
    *grid is not properly refreshed sometimes so force refresh
    *here if you like (optional)
    This.Refresh()
    Endproc

    Procedure ShowPicture(ImageObject, empcode)
    ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif"  
    Endproc
Enddefine

2

Re: Küçük bir yardım

Acizane fikrim ki sorunu kavrayabilmiş değilim

   Procedure ShowPicture(ImageObject, empcode)
    ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif" 
    Endproc

Bunun için önce formunda  "ShowPicture" adında bir metod oluşturup bu procedürü içine yazman gerekiyor gibime geliyor.

Yinede en doğruyu kuşkusuz üstadlar bilir big_smile

3

Re: Küçük bir yardım

Linkteki ornek soruna cevap olur diye dusunuyorum smile

https://www.foxite.com/forum/read.aspx?id=0000289488

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

4 Son düzenleyen, cetinbasoz (24.10.2018 01:30:58)

Re: Küçük bir yardım

Nedense ornek olarak verilen koda bakınca aklımdan bunlar geciyor:

Muhtemelen Jun T. adinda bir filipinli benim yazdigim kodu almış, allamış pullamis ve sanki kendisi yazmış gibi yayinlamis ( muhtemelen foxite'da).

Yapsin tabii de, kodun kaynagini yazma zahmetinde bulunsun. Oyle metod ve değişken ismi değiştirmekle olmuyor, ayıp denen bir şey var (tabii arkadas ne ilk ne de sonuncu). Dil neden ölüyor ya da öldü diye şaşırmamak lazım.

5

Re: Küçük bir yardım

Gökçe Özçınar yazdı:

Sevgili dostlar merhaba.

Aşağıda çok basit bir kod var ve çalışıyor. Ben bunu direkt olarak bir formun içine monte etmek istiyorum.
Grid tamam. load, activate falan tamam. hepsini yerli yerine yerleştirdim. Ama

    Procedure ShowPicture(ImageObject, empcode)
    ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif" 
    Endproc

formda nereye yerleştirmem gerektiğini bulamadım. Bu konuda yardımcı olursanız sevinirim.
Şimdiden teşekkür ederim. Selamlar.

***

Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
    Height = 580
    Width = 600
    AutoCenter = .T.
    Caption = 'Various Images on Grid - Part II'
    ImgPath = _samples+"data\Graphics"

    Add Object Grid1 As Grid WITH ;
        Height = 570, Width = 590, RecordSource="junk",;
        ColumnCount=3, DeleteMark = .F., RowHeight = 180

    Procedure Load
    Set Talk Off
    Set Safety Off

    Select Left(last_name,4)+Left(first_name,4) As empcode, first_name, last_name  From (_samples+"data\employee") ;
        INTO Cursor junk NOFILTER
    Endproc

    Procedure Grid1.Init
    With This.column1 As Column
        .AddObject('myImage','Image')
        .CurrentControl = 'myImage'
        .myImage.Visible = .T.
        .DynamicFontBold = 'thisform.ShowPicture(this.column1.myImage,junk.empcode)'
        .Width = 500
        .Sparse = .F.
        .ReadOnly=.T.
    Endwith
    Endproc

   Procedure Grid1.AfterRowColChange
    Lparameters nColIndex
    * Because this involves getting actual outside images, 
    *grid is not properly refreshed sometimes so force refresh
    *here if you like (optional)
    This.Refresh()
    Endproc

    Procedure ShowPicture(ImageObject, empcode)
    ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif"  
    Endproc
Enddefine

Çalıntı da olsa farketmez, sonuçta forma ShowPicture diye metod ekleyip kodu da oraya ekleyeceksiniz:

lparameters ImageObject, empcode
ImageObject.Picture = Addbs(This.ImgPath)+m.empcode+".gif"