Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom control inherited from IWControls
#1
Hi:

I´m developing some IWControls inherited from TIWEdit.

I would like to ask for help, since I´m having a few problems with the inherited controls in design time.

I must say that I´m using IW 14 bundled version (delphi 10.3), so no access to the source code avaiable.

1# - Inherited controls doesn´t look like their parents in design time. (see picture attached). (solved, see the post bellow)
2# - Not possible to assign ScriptAvents through a method called by other property setter.

There is a boolean property, and based on it´s value a method gets some javascripts in order to be set at scriptevents.
The boolean property setter, after defining the property value, calls the method to add the script events.
The method is being called properly, but before adding the new scripts, is necessery to delete the old ones.
If the old scriptevents are not deleted, the new one is not added.

So, the SetJavaScripts method, looks like this:


procedure TLBIWXEditFloat.SetJavaScripts(aAllowNegative: boolean);
var
  _Idx: Integer;
  _OnKeyDown: TStringList;
begin
  _Idx := Self.ScriptEvents.IndexOf('onKeyDown');

  if _Idx > 0 then
    Self.ScriptEvents.Delete(_Idx);

_OnKeyDown := TLBXIntraWebJs.GetScrptEdtFloatOnKeyDown(aAllowNegative);
  try
    Self.ScriptEvents.Add('onKeyDown', _OnKeyDown.Text);
  finally
    _OnKeyDown.Free;
  end;
end;

The problem is that in design time, "Self.ScriptEvents.IndexOf('onKeyDown')" always returns -1, therefore is impossible to delete the scriptevent, preventing to add the new one.

AllowNegative setter looks like this:

procedure TLBIWXEditFloat.SetAllowNegative(const Value: Boolean);

begin

  FAllowNegative := Value;

  Self.SetJavaScripts(Value);
end;

What am I missing?

Thanx in advance!
Reply


Messages In This Thread
Custom control inherited from IWControls - by LeoBruno - 06-29-2019, 12:39 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)