Edit esnasında mask yapabilen grid

Yapmak istediğiniz işle ilgili doğru bileşeni bulmak için burayı kullanabilirsiniz. Sadece bulmak için, diğer sorular Programlama forumuna lütfen.
Forum kuralları
Bu forum sadece yapacağınız işle alakalı doğru bileşeni bulmak içindir. Şöyle bir şey yapmam lazım, hangi bileşeni kullanıyım diyorsanız, doğru yerdesiniz.
Cevapla
hicker
Üye
Mesajlar: 68
Kayıt: 01 Tem 2003 09:58
Konum: Konya

Edit esnasında mask yapabilen grid

Mesaj gönderen hicker »

merhaba,
problemim mask işlemini editing esnasında yapabilen bir grid bulabilmek yada gridin içine editbox yerleştirebilmek. Developer expressin quantum gridini kullanıyorum. Currency column edit esnasında float değeri olduğu gibi gösterip validate işleminden sonra masklıyor. benim istediğim her tuşa basıldıktan sonra mask uygulanması. bu işlemi yapabileceğim bir grid var mı? veya quantum grid içine maskediti nasıl yerleştirebilirim?
yardımlarınız için teşekkürler....
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7586
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

Merhaba,

bir ara Quantum Grid 4 için böyle bir koda rastlayıp saklamıştım. Altta kodu ve gönderen kişinin düzelttiği halini gönderiyorum.

Kodlar bana ait değil, lütfen detay sorma!

Kod: Tümünü seç

procedure TForm1.cxGrid1DBTableView1TestPropertiesChange(Sender: TObject); 
var 
  InputValue, NewValue: string; 
  DecimalSeparatorPos, I, L: Integer; 
begin 
  with TcxCurrencyEdit(Sender) do 
  begin 
    Properties.OnChange := nil; 
    InputValue := EditingText; 
    NewValue := ''; 
    DecimalSeparatorPos := 0; 
    for I := Length(InputValue) downto 1 do 
      if InputValue[I] in ['0'..'9', DecimalSeparator] then 
      begin 
        if InputValue[I] = DecimalSeparator then 
          DecimalSeparatorPos := Length(InputValue) - (I - 1); 
        L := Length(NewValue) - DecimalSeparatorPos; 
        if ((L mod 3) = (((L div 3)-1) mod 3)) and (L > 0) then 
          NewValue := ',' + NewValue; 
        NewValue := InputValue[I] + NewValue; 
      end; 
    Text := NewValue; 
    SelStart := MaxInt; 
    Properties.OnChange := cxGrid1DBTableView1TestPropertiesChange; 
    EditModified := True; 
    ModifiedAfterEnter := True; 
  end; 
end; 
--------------------------------
procedure TForm1.cxGrid1DBTableView1TestPropertiesChange(Sender: TObject); 
var 
  InputValue, NewValue: string; 
  I: Integer; 
begin 
  with TcxCurrencyEdit(Sender) do 
  begin 
    Properties.OnChange := nil; 
    InputValue := DelChars(EditingText,ThousandSeparator); 
    InputValue := DelChars(InputValue,DecimalSeparator); 
    NewValue := ''; 
    for I := Length(InputValue) downto 1 do begin 
        If (Length(InputValue)-I) mod 3=0 Then NewValue:=ThousandSeparator+NewValue; 
        NewValue := InputValue[I] + NewValue; 
    end; 

    // There is one more thousand separator at the end of text, I remove it with the code below. 

    If Copy(NewValue,Length(NewValue),1)=ThousandSeparator Then NewValue:=Copy(NewValue,1,Length(NewValue)-1); 

    Text := NewValue; 
    SelStart := MaxInt; 
    Properties.OnChange := cxGrid1DBTableView1TestPropertiesChange; 
    EditModified := True; 
    ModifiedAfterEnter := True; 

  end; 
end; 
Kolay gelsin.
Cevapla