View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000766 | JEDI VCL | 00 JVCL Components | public | 2003-03-07 03:16 | 2003-05-21 08:18 |
| Reporter | roko | Assigned To | user72 | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 2.00 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0000766: TJvSpinEdit: OnChange event isn't fired | ||||
| Description | While testing ChangeOptions behavior, I noticed that OnChange event of TJvSpinEdit isn't fired whatever I do with control in runtime. I pressed keys, pressed up/down arrows - value changed in control, it went out of range, but OnChange event in my form wasn't fired. The only way I got it to fire was setting coCheckOnExit in ChangeOptions - when I typed value out of range and switched to other control, OnChange fired. So I examined source, and found culprit. | ||||
| Additional Information | procedure TJvCustomSpinEdit.Change; var >> OldText: string; OldSelStart: Integer; begin { (rb) Maybe move to CMTextChanged } if FChanging or not HandleAllocated then Exit; FChanging := True; try >> OldText := inherited Text; OldSelStart := SelStart; try if not (csDesigning in ComponentState) and (coCheckOnChange in CheckOptions) then begin CheckValueRange(Value, True); SetValue(CheckValue(Value)); end; except SetValue(CheckValue(Value)); end; finally FChanging := False; end; >> if CompareText(inherited Text, OldText) <> 0 then inherited Change; SelStart := OldSelStart; end; Lines marked with '>>' seem to be redundant, as in my tests inherited Text is always equal OldText. After removing these lines everything seems to work. | ||||
| Tags | No tags attached. | ||||
| has duplicate | 0000838 | closed | TJvSpinEdit OnChange() event does not work | |
| has duplicate | 0000896 | closed | remkobonte | OnChange event not firing in TJVSpinEdit |
|
|
This is because at the start of the Change method the inherited Text already has the changed value. What I did was change the Change method in the following way (which is close to the way it was in JVCL 2.0) Instead of: if CompareText(inherited Text, OldText) <> 0 then inherited Change; I now use: if Value <> FOldValue then begin inherited Change; FOldValue:= Value; end; (Don't forget to (re)add FOldValue to TJvCustomSpinEdit and setting FOldValue to 0 in Create. |
|
|
Seems to work fine. Updated in CVS. Thanks |
|
|
This fix has been working for quite a while. Closed. |