delphi - TEdit and focus selection works different depending on Show/showmodal -


when switching focus between tedits, selection changes depending on way show form. when show form.show, , swith between 2 tedits, text selected. when show form form.showmodal, , switch between, cursor @ end of newly focused tedit

reproduce : create new form 2 tedits, type text in both. switch between both tedits, whole text selected, when show form modal, caret positioned behind text.

why there difference in functionality? , can change it.

i found code responsible :

procedure tstylededit.doenter; var   form: tcommoncustomform; begin   inherited;   form := tcommoncustomform(root);   if not model.isreadonly , model.inputsupport , not ftextservice.hasmarkedtext ,     ((form = nil)  //next part returns false or (form.formstate * [tfmxformstate.showing] = [tfmxformstate.showing]) or     (form.formstate = [tfmxformstate.engaged]))     edit.selectall   else   begin     updateselectionpointpositions;     updatecaretposition;   end; end; 

doenter protected method , such can override own method if wish.

you can either classic way creating own descendant class (with different type name) or can use so-called interceptor classes described in link: interceptor classes.

i believed need extend if clause (but not tested - sorry)

  if not model.isreadonly , model.inputsupport , not ftextservice.hasmarkedtext ,     ((form = nil)       or (form.formstate * [tfmxformstate.showing] = [tfmxformstate.showing])       or (form.formstate * [tfmxformstate.modal] = [tfmxformstate.modal])       or (form.formstate = [tfmxformstate.engaged])) 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -