Lazarus - TZUpdateSQL not bringing its update fields selected
Lazarus - TZUpdateSQL not bringing its update fields selected
Hello friends, I have notice that on Lazarus 2.2.4 or above, on the TzUpdateSQL component, the existing update fields are not been selectec when we double click the component. Please see attachment. I wonder if this is a new behavior or a simple bug. On my earlier lazarus version all fields were selected automatically as we defined the last time we edited the component.
Note: Also tested with Zeoslib 8.x. Same behavior.
Thanks.
Renato Ricci
Note: Also tested with Zeoslib 8.x. Same behavior.
Thanks.
Renato Ricci
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello Renato,
currently this is a known issue that I cannot fix. There are other bugs that have to be fixed first.
With best regards,
Jan
currently this is a known issue that I cannot fix. There are other bugs that have to be fixed first.
With best regards,
Jan
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello Jan.. Thanks for the feedback.. For now I will keep with the previous version..marsupilami wrote: ↑11.05.2023, 08:41 Hello Renato,
currently this is a known issue that I cannot fix. There are other bugs that have to be fixed first.
With best regards,
Jan
Thanks and good luck!
Renato
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hi friends.. any news about this bug? Is there any patch?
Thanks
Renato
Thanks
Renato
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello Renato,
unfortunately - no. There simply was no time to look at it yet.
With best regards,
Jan
unfortunately - no. There simply was no time to look at it yet.
With best regards,
Jan
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
If you would like to, you can give me some tips where to look around in the code and I'll try to fix it, and then I'll post you back the solution.marsupilami wrote: ↑26.07.2023, 07:41 Hello Renato,
unfortunately - no. There simply was no time to look at it yet.
With best regards,
Jan
PS: Using Lazarus 2.2.6 / FPC 3.2.2
Thanks.
Renato
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello Renato,
I think the starting point for thius would be ZUpdateSqlEditor.pas in src\component. I assume, it contains the editor window for TZUpdateSQL. I didn't work on that code (yet) so I don't know what it looks like in there.
Best regards,
Jan
I think the starting point for thius would be ZUpdateSqlEditor.pas in src\component. I assume, it contains the editor window for TZUpdateSQL. I didn't work on that code (yet) so I don't know what it looks like in there.
Best regards,
Jan
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Same problem here utilizing Lazarus 3.0.. is there any patch to correct it? Tks.
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello singlesis,
unfortunately there is no patch yet.
With best regards,
Jan
unfortunately there is no patch yet.
With best regards,
Jan
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Hello.. I think I found the solution.. Please validade it..
At file ZUpdateSqlEditor.pas in src/component I have commented out the 2 lines below and it worked, cause does not make sense the component set selected(i) = true and later on it set the itemindex equals 0. (will loose the selection right?). Please check if this is the correct berravior, since as I said, I am not so experient on the component.
1. ListBox.ItemIndex := 0;
2. ListBox.TopIndex := 0;
Also commented the 2 lines at 'SelectAll' procedure:, witch is related to the popup menu..
Thanks.
Renato
At file ZUpdateSqlEditor.pas in src/component I have commented out the 2 lines below and it worked, cause does not make sense the component set selected(i) = true and later on it set the itemindex equals 0. (will loose the selection right?). Please check if this is the correct berravior, since as I said, I am not so experient on the component.
1. ListBox.ItemIndex := 0;
2. ListBox.TopIndex := 0;
Code: Select all
function SetSelectedItems(ListBox: TListBox; List: TStrings): Integer;
var
I: Integer;
begin
Result := 0;
ListBox.Items.BeginUpdate;
try
for I := 0 to ListBox.Items.Count - 1 do
if List.IndexOf(ListBox.Items[I]) > -1 then
begin
ListBox.Selected[I] := True;
Inc(Result);
end
else
ListBox.Selected[I] := False;
if ListBox.Items.Count > 0 then
begin
//ListBox.ItemIndex := 0;
//ListBox.TopIndex := 0;
end;
finally
ListBox.Items.EndUpdate;
end;
end;
Code: Select all
procedure SelectAll(ListBox: TListBox);
var
I: Integer;
begin
ListBox.Items.BeginUpdate;
try
with ListBox do
for I := 0 to Items.Count - 1 do
Selected[I] := True;
if ListBox.Items.Count > 0 then
begin
//ListBox.ItemIndex := 0;
//ListBox.TopIndex := 0;
end;
finally
ListBox.Items.EndUpdate;
end;
end;
Thanks.
Renato
Last edited by rrricci on 06.09.2024, 15:14, edited 2 times in total.
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Just a correction.. Also comment the block:
if ListBox.Items.Count > 0 then
begin
end;
Thanks
Renato Ricci
if ListBox.Items.Count > 0 then
begin
end;
Thanks
Renato Ricci
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
To be honest it's a little bit confusing for me as well. Individual items are (de)selected within the cycle and then we are moving the selection back to the first one? TopIndex alone would make sense IF it does not change selection.
Also what I can not understand, why we are selecting all items in ListBox by hand, if I'm 99% sure ListBox has a .SelectAll method...?
I'll fire up a Delphi 7 to confirm these.
Also what I can not understand, why we are selecting all items in ListBox by hand, if I'm 99% sure ListBox has a .SelectAll method...?
I'll fire up a Delphi 7 to confirm these.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
I did a minimal example and I can confirm that
1, Under Delphi 7 TListBox has .Selected[], .TopIndex and .SelectAll methods
2, Setting .Selected[] or invoking .SelectAll indeed moves the node in question to be visible (they do scroll the scrollbox)
So, the below code is the most efficient and fool-proof way I can imagine:
1, Under Delphi 7 TListBox has .Selected[], .TopIndex and .SelectAll methods
2, Setting .Selected[] or invoking .SelectAll indeed moves the node in question to be visible (they do scroll the scrollbox)
So, the below code is the most efficient and fool-proof way I can imagine:
Code: Select all
procedure TForm1.SelectRandomButtonClick(Sender: TObject);
Var
a: integer;
begin
ListBox1.Items.BeginUpdate;
Try
For a := 0 To ListBox1.Items.Count - 1 Do
ListBox1.Selected[a] := a Mod 2 = 0;
ListBox1.TopIndex := 0;
Finally
ListBox1.Items.EndUpdate;
End;
end;
procedure TForm1.SelectAllButonClick(Sender: TObject);
begin
ListBox1.Items.BeginUpdate;
Try
ListBox1.SelectAll;
ListBox1.TopIndex := 0;
Finally
ListBox1.Items.EndUpdate;
End;
end;
You do not have the required permissions to view the files attached to this post.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Since it is 100% Delphi 7 compatible I issued a pull request on GitHub. I don't have any real-world application to test it on though so I'll leave that to the community :)
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Lazarus - TZUpdateSQL not bringing its update fields selected
Great!
Thanks aehimself!
Thanks aehimself!