Didier Cabalé

Member since: Saturday, 20 September 2014
Last login: 5 years ago
Profile viewed: 1,880 views

Your Rank: 70
Points: 24

Didier Cabalé replied to the topic 'TListItems.Count to 0, whereas TListView has items' in the forum. 5 years ago

1. Thanks a lot Remy for your detailed answer!!

2. I'm not sure to understand you correctly, in this paragraph:

If the DFM then changes an affected property afterwards, RecreateWnd() is called, and its CM_RECREATEWND message *HAS* been processed by the time the OnCreate event is called (as evident by the fact that the ListView's HWND is no longer allocated, so Items.Count returns 0). But, what *HAS NOT* been processed yet by the time of the OnCreate event is the need for a new HWND to be allocated.

example of logic I don't understand : you seem to explain that, in the OnCreate, the CM_RECREATEWND message is undoubtedly achieved because the TListView HWND is 0. If my reformulation is correct, then I don't understand the logic. If not, can you please express it differently?

3. As a solution, you proposed a "ListView1.HandleNeeded". Note that on my side, I proposed a "ListView1.Handle" at the same place :-)

4. This "bug" does not occur with Delphi 10.3 Rio -> no need to add the handle allocation forcing in the OnCreate with Delphi 10.3 Rio

Read More...

Didier Cabalé replied to the topic 'TListItems.Count to 0, whereas TListView has items' in the forum. 5 years ago

1. I use Delphi 10.2 and a VCL project indeed.
2. Please do not forget the essential condition: TListView must be set as ReadOnly at design-time.
Thanks

Read More...

Didier Cabalé replied to the topic 'TListItems.Count to 0, whereas TListView has items' in the forum. 5 years ago

Dear Didier,
I can answer to your first question, ie "why this"?
because:
1. to get this behavior, you probably had set your TListView.ReadOnly property to true, and analyzing the TListView.ReadOnly setter, you have:

procedure TCustomListView.SetReadOnly(Value: Boolean);
begin
  if Value <> ReadOnly then
  begin
    FReadOnly := Value;
    RecreateWnd;
  end;
end;
2. On the program startup, when the control builds itself, its ReadOnly property will change from its default (false) to true, and the code asks the window to be recreated (send a CM_RECREATEWND message). On TForm.OnCreate, the TListView's CM_RECREATEWND has not been processed yet and its windows handle is still not assigned, ie = 0.
And that is the problem: if the TListView handle is not allocated, the function TListItems.GetCount returns 0:
function TListItems.GetCount: Integer;
begin
  if Owner.HandleAllocated then
    Result := ListView_GetItemCount(Handle)
  else
    Result := 0;
end;
(cf 2 attached pictures)
However, I cannot tell you if this is a wanted behavior or if it is a bug.

Read More...

Didier Cabalé created a new topic ' TListItems.Count to 0, whereas TListView has items' in the forum. 5 years ago

Hi all,
I just experienced something weird:
1. Place a TListView on a TForm, and some items (TListItems) inside it.
2. On the TForm's OnCreate event, count its Items (TListView.Items.Count), and state that surprisingly the value is 0.

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  i := ListView1.Items.Count; // =0!!
For a visual synoptic of the problem, see attachment
My questions are:
1. why this?
2. Is this wanted or a bug?
Thanks

Read More...

Didier Cabalé replied to the topic '"Trace to next source line" (shift +F7)' in the forum. 5 years ago

Hi Roger,
1. Thanks for your advice
2. Unfortunately, even after setting a break-point in an "asm" section, running and stopping there, I could not manage to get what you tell me.
-> Have you some simple steps that I could reproduce?
Thanks in advance

Read More...

Didier Cabalé replied to the topic '"Trace to next source line" (shift +F7)' in the forum. 5 years ago

understand now?

Not better..
I still do not understand what makes the advantage of using "shift +F7" vs the classic "F7"
Thanks in advance for your help

Read More...

Didier Cabalé created a new topic ' "Trace to next source line" (shift +F7)' in the forum. 5 years ago

Hi there,

when I want to know in which case I should use "Trace to next source line" (shift +F7)), I don't find many helpful information:
Delphi help says this -> docwiki.embarcadero.com/RADStudio/Berlin..._to_Next_Source_Line
Marco Cantu says here :
"A third option, Trace to Next Source Line (Shift + F7), will move control to the
next line of the source code of your program being executed, regardless of the control
flow. This source code line might be the following line of the source code (as in a Step
Over command), a line inside a function called by your code (as in a Trace Into
command), or a line of code inside an event handler or a callback function of the program
activated by the system".


But this does not tell me in which specific use case this action is interesting to be used, and especially vs the standard "Step over" (F8) and "Trace into" (F7)
Have someone a clearer idea?
Thanks in advance

Read More...

Didier Cabalé created a new topic ' "Private" topic's Category /topic's Category change' in the forum. 5 years ago

Hi there,
I realized that I misplaced a new topic I posted, about FireMonkey: instead of "Application Development - UI" category, I put it on "Private - FieldTest - Aitana - FireMonkey" category.
The user that I am should not be tempted to place the subject in the wrong category. Why? Because if he places a post in a "Private" descendant Category, this has the very unlucky consequence that *his post will never be referenced* for not logged-in users (cf Firemonkey_post_whenlogged.jpg and Firemonkey_post_whennotlogged.jpg)
Therefore:
1. It is very important for a user to be able to modify his post Category, once already posted.
If not, then the post has big chances to remain unanswered, because unseen by most forum users.
2. It is very important to remind to the user that he is about to post in a "Private" descendant Category.
Thanks for your action.

Read More...

Didier Cabalé replied to the topic 'Forums unusable' in the forum. 5 years ago

+1 for b)

Read More...

Didier Cabalé replied to the topic 'forums.embarcadero.com is UP!' in the forum. 5 years ago

YESSS!!!

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

Sorry, cannot see your attachment.
Note to the moderator: is this feature working?

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

preamble for the webmaster: the attachment is accessible only when in "Reply" mode

Ok, now I understand the conditions:
1. Firemonkey application, with, at design-time, a TListBox.
2. TSearchBox as TListBox child, added at run-time.
3. State that, magically, the TSearchBox filters the TListBox content.
The DocWiki pageDocWiki says: "TSearchBox is an edit control that provides search capabilities such as filtering the result in the parent"

Thanks for reminding us this capability.

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

> if i add a searchbox control and set it parent to my listbox ..

I understand that you use the *FMX* TListView control with the SearchVisible property set to true, that makes embed a TSearchBox inside the TListView at its top.
If you use the *VCL* TListView or TListBox, then you cannot embed a TSearchBox inside.
Preferably, could you please attach a sample project describing your starting situation in order to avoid useless assumptions.

Read More...

Didier Cabalé replied to the topic 'cannot attach file or Tag to posts' in the forum. 5 years ago

other test to attach a .zip

File Attachment:

File Name: 2018-04-01.zip
File Size: 44 KB
file

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

> if i add a searchbox control and set it parent to my listbox ..

I understand that you use the *FMX* TListView control with the SearchVisible property set to true, that makes embed a TSearchBox inside the TListView at its top.
If you use the *VCL* TListView or TListBox, then you cannot embed a TSearchBox inside.
Preferably, could you please attach a sample project describing your starting situation in order to avoid useless assumptions.

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

> if i add a searchbox control and set it parent to my listbox ..

1. I could not add any standalone FMX.TSearchBox, because as the says DocWiki TSearchBox help : "TSearchBox is an edit control that provides search capabilities such as filtering the result in the parent."

2. Thus I understand that you use the *FMX* TListView (not TListBox) control with the SearchVisible property set to true, that makes embed a TSearchBox inside the TListView at its top. Correct?

3. If you use the *VCL* TListView or TListBox, then you cannot embed a TSearchBox inside.

Preferably, could you please attach a sample project describing your starting situation in order to avoid useless assumptions.

Read More...

Didier Cabalé replied to the topic 'searchbox - start the search by first typed key' in the forum. 5 years ago

> if i add a searchbox control and set it parent to my listbox ..

I understand that you use the *FMX* TListView control with the SearchVisible property set to true, that makes embed a TSearchBox inside the TListView at its top.
If you use the *VCL* TListView or TListBox, then you cannot embed a TSearchBox inside.
Preferably, could you please attach a sample project describing your starting situation in order to avoid useless assumptions.

Read More...

Didier Cabalé replied to the topic 'searchbox - how to start the search by first char' in the forum. 5 years ago

1. not sure to understand correctly your question: what is an "automatic search"? search start after typing the 1 char or after typing 2 chars? what is your "listbox" ragarding the TSearchBox?
2. if I assume you want to run a search after the 1st char is typed, then why would'nt you run your search on the TSearchBox.OnChange event (leaving nil the classical TSearchBox.OnInvokeSearch)?

Read More...