Sayfayı Yazdır | Pencereyi Kapat

Probuton Resim değiştirme

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Clomosy ile değişken kullanımı
Forum Tanımlaması: TRObject dili ile değişken tanımlaması ve ekranda gösterme
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=1230
Tarih: 17 Kasım 2025 Saat 21:06
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Probuton Resim değiştirme
Mesajı Yazan: M-Guney
Konu: Probuton Resim değiştirme
Mesaj Tarihi: 17 Kasım 2025 Saat 15:18
Memory stream den aldığım resmi probuttonun resmi yapmak istiyorum.
Veritabanından tek bir endpoint ile bütün kategorilerin resimlerini ve adlarını göstermek istiyorum.

void FillItemsPnlV(FQry: TCLJSONQuery)
  var 
  I : Integer;
  TempCategoryNameLbl: TclProLabel;
  TempItemImageBtn : TLCProImage;
  TempItemsPnl : TclProPanel;
  TempImageBase64 : String;
  LMemStream:TCLMemoryStream;
  {
   I = 0;
  Try
    with FQry do
    {
      if (Found)
      {
        First;
        while (not EOF)
        {
          Try
          
            TempCategoryNameLbl = MainForm.clFindComponent('CategoryNameLbl' + IntToStr(I)) as TclProLabel;
            if (TempTableLbl <> nil)
            {
              TempCategoryNameLbl.Text = FieldByName('category_name').AsString;
            }
            TempItemsPnl = MainForm.clFindComponent('ItemsPnl' + IntToStr(I)) as TclProPanel;
            if (TempOrdersPnl <> nil)
            {
              ItemsPnl.height = (MainForm.clHeight * 0.2101); // 176.25 / 839 ≈ 0.2101
              ItemsPnl.width = (MainForm.clWidth * 0.4200); // 165 / 393 ≈ 0.4200
            }
            
            TempItemImageBtn = MainForm.clFindComponent('ItemImageBtn' + IntToStr(I));
            if(TempItemImageBtn <> nil)
            {
              TempImageBase64 = FieldByName('category_image_base64').AsString;
              LMemStream = Clomosy.Base64ToStream(TempImageBase64);
              TempItemImageBtn.Bitmap.LoadFromStream(LMemStream);
              
              //TempItemImageBtn.clProSettings.PictureSource = 
              
            }
  
            Next;
            Inc(I);
          except
          
            ShowMessage('Index ' + IntToStr(I) + ' için hata: ' + LastExceptionMessage);
            Next;
            Inc(I);
          }
        }
        LMemStream.Free;
      }
    }
    ShowMessage(' Veriler dolduruldu. Toplam: ' + IntToStr(I) + ' kayıt');
  
  except
  
    ShowMessage('FillOrdersPnlV hatası: ' + LastExceptionMessage);
  }
}
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">



Cevaplar:
Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 17 Kasım 2025 Saat 18:15
Merhaba Güney, 
Image1.Bitmap.LoadFromStream(FileStream) için TclProImage değil TclImage kullanmak gerekiyor
çünkü özellikle olarak pro bileşeninnde yok 
https://www.docs.clomosy.com/TclImage" rel="nofollow - https://www.docs.clomosy.com/TclImage


var
  MainForm: TclForm;
  JsonResponse: String;
  FQry: TCLJSONQuery;


void FillItemsPnlV(FQry: TCLJSONQuery)
var
  I: Integer;
  TempCategoryNameLbl: TclProLabel;
  TempItemImage: TclPImage;  
  TempItemsPnl: TclProPanel;
  TempImageBase64: String;
  LMemStream: TCLMemoryStream;
{
  I = 0;
  Try
    with FQry do
    {
      if (Found)
      {
        First;
        while (not EOF)
        {
          Try
            TempCategoryNameLbl = MainForm.clFindComponent('CategoryNameLbl' + IntToStr(I)) as TclProLabel;
            if (TempCategoryNameLbl <> nil)
            {
              TempCategoryNameLbl.Text = FieldByName('category_name').AsString;
            }
            
            TempItemsPnl = MainForm.clFindComponent('ItemsPnl' + IntToStr(I)) as TclProPanel;
            if (TempItemsPnl <> nil)
            {
              TempItemsPnl.Height = (MainForm.clHeight * 0.2101); // 176.25 / 839 ≈ 0.2101
              TempItemsPnl.Width = (MainForm.clWidth * 0.4200); // 165 / 393 ≈ 0.4200
            }
            
            TempItemImage = MainForm.clFindComponent('ItemImage' + IntToStr(I)) as TclProImage;
            if (TempItemImage <> nil)
            {
              TempImageBase64 = FieldByName('category_image_base64').AsString;
              
              if (TempImageBase64 <> '')
              {
                Try
                {
                  // ✅ 5. Base64'ten MemoryStream'e çevir
                  LMemStream = Clomosy.Base64ToStream(TempImageBase64);
                  
                  if (LMemStream <> nil)
                  {
                    TempItemImage.Bitmap.LoadFromStream(LMemStream);
                    
                    LMemStream.Free;
                    LMemStream = nil;
                  }
                }
                except
                
                  ShowMessage('Resim yükleme hatası (Index ' + IntToStr(I) + '): ' + LastExceptionMessage);
                  
                  if (LMemStream <> nil)
                  {
                    LMemStream.Free;
                    LMemStream = nil;
                  }
                }
              }
              else
              {
                TempItemImage.clProSettings.PictureSource = ' https://clomosy.com/demos/default.png" rel="nofollow - https://clomosy.com/demos/default.png ';
                TempItemImage.SetclProSettings(TempItemImage.clProSettings);
              }
            }
            
            Next;
            Inc(I);
          except
            ShowMessage('Index ' + IntToStr(I) + ' için hata: ' + LastExceptionMessage);
            Next;
            Inc(I);
          }
        }
      }
    }
    
    ShowMessage(' Veriler dolduruldu. Toplam: ' + IntToStr(I) + ' kayıt');
  
  except
  
    ShowMessage(' FillItemsPnlV hatası: ' + LastExceptionMessage);
  }
}

https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net