Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/07/25 in Posts

  1. pyscripter

    New ChatLLM application.

    A new version 1.2.0 of ChatLLM has been released: New Features: Much improved rendering of responses on a par with the Web Chat interfaces of the LLM providers. Syntax highlighting of code (300 languages are now supported thanks to Prism). Support for DeepSeek models Support for reasoning models such as OpenAI's o1-mini and DeeepSeek's deepseek-reasoner. Exposed the temperature LLM parameter. Screenshots: Settings: User interface: Reasoning with deepseek-reasoner: And by the way DeepSeek is so much better than Gemini on Delphi coding.
  2. Is there any way to train an AI model with Remy's brain?
  3. Beppe Magistro

    Delphi iOS Push Notifications (APNS)

    thank you very much !!! i will try asap
  4. The reason this is not optimised away is that it would take development effort to do so but would bring no benefit to anyone.
  5. Anders Melander

    Does anyone know a delphi component that can play videos from a stream

    The application is closed source but I have attached the relevant unit (and one dependency). There are a lot of unrelated dependencies in that unit, since it is a part of a large resource editor framework, so unfortunately it's not as readable as it could be. The unit implements a viewer for video and sound media resources. amResourceViewMedia.pas amResourceViewMedia.dfm VFW.pas
  6. When using VarSameValue(), you can get a conversion failure if the 2 Variants are not holding compatible types. This is even stated in the documentation: So, you should first make sure the 2 Variants have the same type before comparing their values. This is just logical to do anyway, since if you know they have different types then there is no point in wasting resources to compare the values. When I make these small changes to TTestComponent, the "Could not convert variant" error goes away: procedure TTestComponent.SetCheckedValue(const Value: Variant); begin if (VarType(FCheckedValue) <> VarType(Value)) or // <-- ADD THIS! (not VarSameValue(FCheckedValue, Value)) then begin FCheckedValue := Value; CheckedValueChanged(); end; end; function TTestComponent.IsCheckedValueStored: Boolean; begin Result := (VarType(FCheckedValue) <> varBoolean) or // <-- ADD THIS! (not VarSameValue(FCheckedValue, True)); end; Now, that just leaves the problem of the 'CheckedValue.Type' property displaying "Unknown" for string values. That is indeed a bug in the default Variant property editor, which I have now reported to Embarcadero: RSS-2844; TVariantTypeProperty is broken for string values You can easily work around the bug, either directly in your component's property setter: procedure TTestComponent.SetCheckedValue(const Value: Variant); begin if (VarType(FCheckedValue) <> VarType(Value)) or (not VarSameValue(FCheckedValue, Value)) then begin FCheckedValue := Value; if VarType(FCheckedValue) = varString then FCheckedValue := VarToStr(Value); // <-- change the VarType to varUString CheckedValueChanged(); end; end; Or by deriving a custom property editor in your component's design-time package (if you don't have one, make one) to fix the bug directly: uses Variants, DesignIntf, DesignEditors, DesignConst; //... { TMyVariantTypeProperty } // unfortunately, TVariantTypeProperty is hidden in the implementation // of the DesignEditors unit, so we have to copy the entire class just // to change a couple of lines! const VarTypeNames: array[varEmpty..varInt64] of string = ( 'Unassigned', // varEmpty 'Null', // varNull 'Smallint', // varSmallint 'Integer', // varInteger 'Single', // varSingle 'Double', // varDouble 'Currency', // varCurrency 'Date', // varDate 'OleStr', // varOleStr '', // varDispatch '', // varError 'Boolean', // varBoolean '', // varVariant '', // varUnknown '', // [varDecimal] '', // [undefined] 'Shortint', // varShortInt 'Byte', // varByte 'Word', // varWord 'LongWord', // varLongWord 'Int64'); // varInt64 type TMyVariantTypeProperty = class(TNestedProperty) public function AllEqual: Boolean; override; function GetAttributes: TPropertyAttributes; override; function GetName: string; override; function GetValue: string; override; procedure GetValues(Proc: TGetStrProc); override; procedure SetValue(const Value: string); override; end; function TMyVariantTypeProperty.AllEqual: Boolean; var i: Integer; V1, V2: Variant; begin Result := False; if PropCount > 1 then begin V1 := GetVarValue; for i := 1 to PropCount - 1 do begin V2 := GetVarValueAt(i); if VarType(V1) <> VarType(V2) then Exit; end; end; Result := True; end; function TMyVariantTypeProperty.GetAttributes: TPropertyAttributes; begin Result := [paMultiSelect, paValueList, paSortList]; end; function TMyVariantTypeProperty.GetName: string; begin Result := 'Type'; end; function TMyVariantTypeProperty.GetValue: string; begin case VarType(GetVarValue) and varTypeMask of Low(VarTypeNames)..High(VarTypeNames): Result := VarTypeNames[VarType(GetVarValue) and varTypeMask]; varString,varUString: // <-- FIX HERE! Result := SString; else Result := SUnknown; end; end; procedure TMyVariantTypeProperty.GetValues(Proc: TGetStrProc); var i: Integer; begin for i := 0 to High(VarTypeNames) do if VarTypeNames[i] <> '' then Proc(VarTypeNames[i]); Proc(SString); end; procedure TMyVariantTypeProperty.SetValue(const Value: string); function GetSelectedType: Integer; var i: Integer; begin Result := -1; for i := 0 to High(VarTypeNames) do if VarTypeNames[i] = Value then begin Result := i; break; end; if (Result = -1) and (Value = SString) then Result := varUString; // <-- FIX HERE! end; var NewType: Integer; V: Variant; begin NewType := GetSelectedType; case NewType of varEmpty: VarClear(V); varNull: V := NULL; -1: raise EDesignPropertyError.CreateRes(@SUnknownType); else V := GetVarValue; // <-- move here for good measure... try VarCast(V, V, NewType); except { If it cannot cast, clear it and then cast again. } VarClear(V); VarCast(V, V, NewType); end; end; SetVarValue(V); end; { TMyVariantProperty } // fortunately, TVariantProperty is public in the DesignEditors unit, // so we need to override only 1 method in it... type TMyVariantProperty = class(TVariantProperty) procedure GetProperties(Proc: TGetPropProc); override; end; procedure TMyVariantProperty.GetProperties(Proc: TGetPropProc); begin Proc(TMyVariantTypeProperty.Create(Self)); end; procedure Register; begin //... // change the 2nd and 3rd properties if you want to reuse this editor for all Variant properties, eg: // RegisterPropertyEditor(TypeInfo(Variant), nil, '', TMyVariantProperty); RegisterPropertyEditor(TypeInfo(Variant), TTestComponent, 'CheckedValue', TMyVariantProperty); end;
  7. This has nothing to do with records. Properties simply don't allow you to directly pass in parameters to the getter/setter methods of the read/write specifiers. However, there is an alternative - put the strings into an array, and then use an index specifier on the property, which will get passed to the getter method when it is called, eg: type TMyRec = record private function ConvertStrToInt(IndexOfStrToConvert: Integer): Integer; public const N = ...; public StrArr: array[0..N-1] of string; property IntA: Integer index 0 read ConvertStrToInt; //... property IntN: Integer index N-1 read ConvertStrToInt; end; function TMyRec.ConvertStrToInt(IndexOfStrToConvert: Integer): Integer; begin Result := StrToInt(StrArr[IndexOfStrToConvert]); end;
  8. DelphiUdIT

    Enable Discussions on github ?

    My personal opinion is that having too many discussion points on a single topic is counterproductive. Having n. Forums, githubs and maybe personal blogs could be dispersive for the information and discussions that you want to "carry forward". And in this particular case, the main actor that is Remy should disperse a lot of energy on a multitude of discussion "sites" (which in fact he already does). The idea is not "evil", but there are already several possible discussion points (for example one of these is this forum) with a dedicated section.
  9. dummzeuch

    What is the best AI at Delphi

    You have listed chatGPT. Which version(s) were you using? My own experience is that neither the free chatGPT nor Gemini are any good for producing Delphi code. I haven't tried any others.
  10. Keesver

    FMX-GRID Released

    Hello all, We are pleased to anounce the availability of a new Delphi grid control specifically designed for FMX. This control runs on all platforms, is easy on the memory, updatess fast and has smooth scrolling. There is a free version available that includes the following features: Connects to different data sources (Lists, List<T>, TDataset) Smart row caching results in low memory usage Fast scrolling Hierarchical views Extendable property model based on .Net type system (object properties can be modified at runtime) Development backed up by a professional team of FMX developers Components used in professional software (Lynx/Lynx-x) by a large user community We also provide a commercial version, this version adds model support and property binding to visual controls. You can easily bind properties to editors for advanced two way syncing. Please go to https://github.com/a-dato/FMX-GRID.git to download the free version. Community site: https://community.a-dato.com
×