'Invalid variant type conversion' in TEdit

;) I'm trying to use the 'PasswordChar'-Property of a TEdit class.
Always when starting the script, i get the error 'invalid variant type conversion'.

How can i solve the problem without adding a new special class?

Comments

  • edited 4:00PM
    Fix the fs_iinterpreter.pas file:
    function TfsPropertyHelper.GetValue: Variant;
    var
      p: PPropInfo;
      Instance: TObject;
    begin
      Result := Null;
      Instance := TObject(Integer(ParentValue));
    
      if FIsPublished then
      begin
        p := GetPropInfo(Instance.ClassInfo, Name);
        if p <> nil then
          case p.PropType^.Kind of
            tkInteger, tkSet, tkEnumeration, tkClass:
              Result := GetOrdProp(Instance, p);
    
            tkFloat:
              Result := GetFloatProp(Instance, p);
    
            tkString, tkLString, tkWString:
              Result := GetStrProp(Instance, p);
    
            tkChar, tkWChar:
              Result := Chr(GetOrdProp(Instance, p));
    
            tkVariant:
              Result := GetVariantProp(Instance, p);
          end;
      end
      else if Assigned(FOnGetValue) then
        Result := FOnGetValue(Instance, FClassRef, AnsiUpperCase(Name));
    
      if Typ = fvtBool then
        if Result = 0 then
          Result := False else
          Result := True;
    end;
    
    procedure TfsPropertyHelper.SetValue(const Value: Variant);
    var
      p: PPropInfo;
      Instance: TObject;
      IntVal: Integer;
    begin
      if IsReadOnly then Exit;
      Instance := TObject(Integer(ParentValue));
    
      if FIsPublished then
      begin
        p := GetPropInfo(Instance.ClassInfo, Name);
        if p <> nil then
          case p.PropType^.Kind of
            tkInteger, tkSet, tkEnumeration, tkClass:
            begin
              if Typ = fvtBool then
                if Value = True then
                  IntVal := 1 else
                  IntVal := 0
              else
                IntVal := Integer(Value);
              SetOrdProp(Instance, p, IntVal);
            end;
    
            tkFloat:
              SetFloatProp(Instance, p, Extended(Value));
    
            tkString, tkLString, tkWString:
              SetStrProp(Instance, p, String(Value));
    
            tkChar, tkWChar:
              SetOrdProp(Instance, p, Ord(String(Value)[1]));
    
            tkVariant:
              SetVariantProp(Instance, p, Value);
          end;
      end
      else if Assigned(FOnSetValue) then
        FOnSetValue(Instance, FClassRef, AnsiUpperCase(Name), Value);
    end;
    
  • edited 4:00PM
    ;) Thank you Admin.
    If changed the thing, tested it, and it worked.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.