Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Editing subitems u listview

[es] :: Pascal / Delphi / Kylix :: Editing subitems u listview

[ Pregleda: 2029 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Brkic

Član broj: 55360
Poruke: 1222
*.dynamic.isp.telekom.rs.



Profil

icon Editing subitems u listview18.02.2011. u 17:38 - pre 159 meseci
Probao sa
tab.ItemFocused.EditCaption;
ali samo prvi red edituje,
kako ostale redove editovati ?
 
Odgovor na temu

lan-mi
Lukic Milan
Zrenjanin

Član broj: 156359
Poruke: 140
*.dynamic.sbb.rs.

Sajt: https://lanmisoft.com


+1 Profil

icon Re: Editing subitems u listview18.02.2011. u 20:01 - pre 159 meseci
tab.Itemfocused.Subitems[0]:='izmeni';
Arduino Control Center
 
Odgovor na temu

Brkic

Član broj: 55360
Poruke: 1222
*.dynamic.isp.telekom.rs.



Profil

icon Re: Editing subitems u listview18.02.2011. u 20:12 - pre 159 meseci
Pa ne tako, nego npr. dvoklik na red i da se iz tabele može direktno izmenuti Subitems-i na kojem je kliknuto.

Ovo što sam napisao u prvom postu omogućava izmenu samo 1 kolone=Caption a treba mi da tako mogu i sa ostalim Subitems-ima.
 
Odgovor na temu

rambo
Dejan Petković
Beograd

Član broj: 6095
Poruke: 190
*.static.isp.telekom.rs.



+6 Profil

icon Re: Editing subitems u listview21.02.2011. u 08:35 - pre 159 meseci
Standardni ListView nema mogućnost editovanja SubItema već samo Captiona. Ako ti to baš treba, preporučujem da pređeš na VirtualTreeView. Trebaće ti malo vremena da ukapiraš kako funkcioniše, ali nakon toga nećeš prestati da je koristiš. Pored toga što je edit moguć u svim kolonama, komponenta ti daje punu kontrolu nad time šta i kako korisnik može da radi, kao i mogućnost da zameniš običan edit sa nekom drugom kontrolom (ComboBox, DateTimePicker, ...).
"There is a theory which states that if ever anybody discovers exactly what the
Universe is for and why it is here, it will instantly disappear and be replaced by
something even more bizarre and inexplicable. There is another theory which states
that this has already happened."
-- Douglas Adams
 
Odgovor na temu

Brkic

Član broj: 55360
Poruke: 1222
*.dynamic.isp.telekom.rs.



Profil

icon Re: Editing subitems u listview21.02.2011. u 09:26 - pre 159 meseci
Hvala na savetu,
ListView mi je u ovom programu neka pomoćna tabelica pa sam mislio ubaciti mogućnost uzmene podataka, ali kada ne može ko ga šiša, neću sve menjati zbog toga.

Još jednom hvala.
 
Odgovor na temu

tkaranovic
Tomislav Karanović
Beograd

Član broj: 220507
Poruke: 307



+18 Profil

icon Re: Editing subitems u listview21.02.2011. u 13:46 - pre 159 meseci
VirtualTreeView je dobra preporuka... ali pošto ćeš zadržati ListView evo kako može:

Code:

procedure TNekaForma.ListView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  ListItem: TListItem;
  Column, Len: Integer;
  Edit: TEdit;
  i: Integer;
begin
  ListItem := ListView1.GetItemAt(X, Y);
  if not Assigned(ListItem) then
    Exit;

  Column := 0;
  Len := X;

  while Len > ListView1.Columns[Column].Width do
  begin
    Len := Len - ListView1.Columns[Column].Width;
    Inc(Column);
  end;

  Dec(Column);

  Edit := TEdit.Create(ListView1);
  try
    Edit.Parent := ListView1;
    Edit.Left := X;
    Edit.Top := y;

    if (Column > -1)and(Column < ListItem.SubItems.Count) then
      Edit.Text := ListItem.SubItems[Column]
    else
    if (Column = ListItem.SubItems.Count)and(Column < ListView1.Columns.Count) then
      Edit.Text := '';

    EndEdit := False;
    //Edit.OnKeyDown := Edit1KeyDown;

    Edit.SetFocus;
    i := 0;
    while i < 100 do
    begin
      Application.ProcessMessages;
      if EndEdit then
        break;
      Inc(i);
      sleep(100);
    end;

    if (Column > -1)and(Column < ListItem.SubItems.Count) then
      ListItem.SubItems[Column] := Edit.Text
    else
    if (Column = ListItem.SubItems.Count)and(Column < ListView1.Columns.Count) then
      ListItem.SubItems.Add(Edit.Text);

  finally
    Edit.Free;
  end;  
end;


Ovo, naravno, ima nedostataka tako da bi morao da je doradiš. U Edit1KeyDown može da bude:

Code:

  if Key = VK_RETURN then
    EndEdit := True;

 
Odgovor na temu

Brkic

Član broj: 55360
Poruke: 1222
*.dynamic.isp.telekom.rs.



Profil

icon Re: Editing subitems u listview21.02.2011. u 19:15 - pre 159 meseci
Probao sam i odlično je,
EndEdit treba staviti kao "boolean"
ubacio sam Edit1KeyDown i radi OK.


[Ovu poruku je menjao Brkic dana 23.02.2011. u 14:01 GMT+1]
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: Editing subitems u listview

[ Pregleda: 2029 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.