0
votes

What I have read here (When the user selects an edit control, .... and highlights its text by using reverse video) and if I understand it right, CEdit should highlight (I hope it's the same as select) text when I click on it.

I'm using CMFCPropertyGridCtrl with CMFCPropertyGridProperty. But when I click on grid (one property value), it doesn't select anything.

What I have found out: Property creates internally CEdit, which is for manually editing property value. It's created, its font is set etc. Then SetFocus is called and after that UpdateWindow - this redraws edit box and sets cursor before first character. After this, mouse click is evoked again to click on edit box - this seems correct. But no text is selected.

I have also tried to create my own property class, which derives from CMFCPropertyGridProperty. I have called SetSel after all this. It really selects my text, but then it just deselects it (in next Redraw). What I have also achieved was that after Redraw only text from begining to mouse click was selected (when I clicked after 4th character, only first 4 characters were selected).

My questions:

Should CEdit really select automaticaly text after first mouse click? (do you have some resources?)

Don't you know, why this is not working in CMFCPropertyGridProperty?

CMFCPropertyGridCtrl and CMFCPropertyGridProperty can be found in afxpropertygridctrl.h/.cpp in mfc source code directory.

1

1 Answers

0
votes

So what I have finally found out:

CEdit probably doesn't select text after clicking on it. This has to be done manually by for example SetSel function.

But in CMFCPropertyGridCtrl, if you click, it's passed to CMFCPropertyGridProperty and there is click repeated. So if I used SetSel, it deselects text. So I had to write my own class which inherits CMFCPropertyGridProperty and skips this step (clicking again). It's enough to SetFocus and SetSel (which also sets cursor to CEdit window).