
gonzales
Пользователи-
Постов
325 -
Зарегистрирован
-
Посещение
-
Победитель дней
27
gonzales стал победителем дня 10 марта
gonzales имел наиболее популярный контент!
Посетители профиля
11 096 просмотров профиля
Достижения gonzales
-
gonzales подписался на Как в TStringGrid изменить цвет текста по условию? , Установка на андроид , Как отоловить нажатие на чекбокс в итеме? и 2 других
-
Часто помогают методы beginupdate endupdate
-
Andrey Efimov отреагировал на ответ на вопрос: не могу скомпилить проект в delphi 11
-
Привет. Давно было, уже не помню, но судя по тому, что я написал проблема в файле проекта. Открой dproj файл, посмотрю, что там внутри
-
gonzales отреагировал на ответ на вопрос: Как отоловить нажатие на чекбокс в итеме?
-
ааа, вообще все свое))) текст в том числе))) я понял, спасибо! так радикально я не додумался поступить
-
я так пробовал сделать, но почему-то чекбокс вставленный в итем с выравниванием по левому краю перекрывает текст итема, я так и не разобрался, почему это происходит, но нашел процедуру у родного итема - ChangeCheck. Корявенько конечно получилось с точки зрения логики, часть функционала в компоненте, а часть нет, но пока забил
-
Доброго времени суток. Собственно вопрос в теме поста. Пишу наследника от TListBoxItem, хочу выполнить процедуру при нажатии на чекбокс, но подходящих событий не наблюдаю. OnClick не приводит к нужному результату. Есть еще StylesData['check'], который вроде как должен быть TCheckBox, но я не пойму как с ним работать.
-
Оставлю тут инфу, чтобы не забыть. Понадобилось тоже шифровать текст, сделал себе простенький юнит на основе https://github.com/MHumm/DelphiEncryptionCompendium unit Encrypt_unit; interface uses DECCipherBase, DECFormatBase, DECCipherModes, System.SysUtils, System.TypInfo, Generics.Collections, DECBaseClass, DECFormat, DECCipherFormats, DECCiphers, DECUtil, DECCipherInterface, FMX.Dialogs; const FILLER_TEXT = '01'; INIT_VECTOR_TEXT = '127E22'; KEY_TEXT = '123456ADE'; CIPHER_FUNCTION = 'TCipher_1DES'; CIPHER_MODE = 'cmCTSx'; AuthenticationBitLength = 128; EditAuthenticatedData = ''; EditExpectedAuthenthicationResult = ''; EditCalculatedAuthenticationValue = ''; FORMAT_TEXT = 'TFormat_Copy'; var EditFiller: string; EditInitVector: string; EditKey: string; function EncryptText(EditPlainText: string): string; function DecryptText(EditCipherText: string): string; implementation function GetSelectedCipherMode: TCipherMode; var ModeStr: string; begin ModeStr := CIPHER_MODE; if ModeStr.Contains('(') then ModeStr := ModeStr.Remove(ModeStr.IndexOf('(') - 1); result := TCipherMode(System.TypInfo.GetEnumValue(TypeInfo(TCipherMode), ModeStr)); end; function GetCipherInstance: TDECCipherModes; begin result := TDECCipher.ClassByName(CIPHER_FUNCTION).Create as TDECCipherModes; result.Mode := GetSelectedCipherMode; end; {function IsAuthenticatedCipher: Boolean; var Cipher: TDECCipherModes; begin Cipher := GetCipherInstance; try result := Cipher.IsAuthenticated; finally Cipher.Free; end; end; procedure UpdateAuthenticationStatus; begin IsAuthenticatedCipher; end; procedure InitCipherAlgorithm; var Context: TCipherContext; begin Context := TDECCipher.ClassByName(CIPHER_FUNCTION).Context; UpdateAuthenticationStatus; end;} function GetInitializedCipherInstance: TDECCipherModes; var FillerByte: UInt8; begin EditFiller := FILLER_TEXT; EditInitVector := INIT_VECTOR_TEXT; EditKey := KEY_TEXT; if not EditFiller.IsEmpty then begin while length(EditFiller) < 2 do EditFiller := '0' + EditFiller; FillerByte := StrToInt('0x' + EditFiller) end else FillerByte := 0; if TFormat_HEXL.IsValid(RawByteString(EditInitVector.ToLower)) and TFormat_HEXL.IsValid(RawByteString(EditKey.ToLower)) then begin result := GetCipherInstance; result.Init(BytesOf(TFormat_HEXL.Decode(RawByteString(EditKey.ToLower))), BytesOf(TFormat_HEXL.Decode(RawByteString(EditInitVector.ToLower))), FillerByte); end else raise Exception.Create('No valid encryption key or init vector given!'); end; procedure SetAuthenticationParams(Cipher: TDECCipherModes); begin Assert(Assigned(Cipher)); if Cipher.IsAuthenticated then begin Cipher.AuthenticationResultBitLength := AuthenticationBitLength; Cipher.DataToAuthenticate := TFormat_HEXL.Decode(BytesOf(RawByteString(EditAuthenticatedData))); Cipher.ExpectedAuthenticationResult := TFormat_HEXL.Decode(BytesOf(RawByteString(EditExpectedAuthenthicationResult))); end; end; function GetFormatSettings(var PlainTextFormatting, CipherTextFormatting: TDECFormatClass): Boolean; begin PlainTextFormatting := TDECFormat.ClassByName(FORMAT_TEXT); CipherTextFormatting := TDECFormat.ClassByName(FORMAT_TEXT); result := true; end; function EncryptText(EditPlainText: string): string; var Cipher: TDECCipherModes; InputFormatting: TDECFormatClass; OutputFormatting: TDECFormatClass; InputBuffer: TBytes; OutputBuffer: TBytes; begin result := ''; if not GetFormatSettings(InputFormatting, OutputFormatting) then exit; try Cipher := GetInitializedCipherInstance; try InputBuffer := System.SysUtils.BytesOf(EditPlainText); if InputFormatting.IsValid(InputBuffer) then begin // Set all authentication related properties SetAuthenticationParams(Cipher); try OutputBuffer := (Cipher as TDECFormattedCipher).EncodeBytes(InputFormatting.Decode(InputBuffer)); (Cipher as TDECFormattedCipher).Done; except On e: Exception do ShowMessage('Encryption failure:' + sLineBreak + e.Message); end; result := string(DECUtil.BytesToRawString(OutputFormatting.Encode(OutputBuffer))); end else ShowMessage('Input has wrong format'); finally Cipher.Free; end; except On e: Exception do ShowMessage('Encryption init failure: ' + e.Message); end; end; function DecryptText(EditCipherText: string): string; var Cipher: TDECCipherModes; CipherTextFormatting: TDECFormatClass; PlainTextFormatting: TDECFormatClass; CipherTextBuffer: TBytes; PlainTextBuffer: TBytes; AuthenticationOK: Boolean; begin result := ''; if not GetFormatSettings(PlainTextFormatting, CipherTextFormatting) then exit; try Cipher := GetInitializedCipherInstance; try CipherTextBuffer := System.SysUtils.BytesOf(EditCipherText); if CipherTextFormatting.IsValid(CipherTextBuffer) then begin // Set all authentication related properties SetAuthenticationParams(Cipher); AuthenticationOK := false; try PlainTextBuffer := (Cipher as TDECFormattedCipher).DecodeBytes(CipherTextFormatting.Decode(CipherTextBuffer)); // in case of an authenticated cipher mode like cmGCM the Done method // will raise an exceptino when the calculated authentication value does // not match the given expected one (Cipher as TDECFormattedCipher).Done; // If we managed to get to here, the calculated authentication value is // ok if we're in an authenticated mode and have entered an expected value. if (length(EditExpectedAuthenthicationResult) > 0) and (length(EditExpectedAuthenthicationResult) = length(EditCalculatedAuthenticationValue)) then AuthenticationOK := true; except On e: Exception do ShowMessage('Decryption failure:' + sLineBreak + e.Message); end; result := string(DECUtil.BytesToRawString(PlainTextFormatting.Encode(PlainTextBuffer))); end else ShowMessage('Input has wrong format'); finally Cipher.Free; end; except On e: Exception do ShowMessage('Decryption init failure: ' + e.Message); end; end; end.
-
Semitako отреагировал на вопрос: Push в Delphi11
-
это растровый стиль, если ткнуть дважды в элемент откроется окно с картинкой и областью, которая будет отображаться на канве. векторные стили встроенные C:\Program Files (x86)\Embarcadero\Studio\22.0\Redist\styles\Fmx
-
Возможно у тебя не векторный стиль. У меня вот так,
-
Color := Stringgrig.StylesData['background.content.selection.Fill.Color'] Это просто набор цветов, который я использую. Я дал пример, выдранный из одного моего проекта, нигде ничего четко написано не будет))) Для понимания работы цветов в firemonkey - вот почитайте https://docwiki.embarcadero.com/RADStudio/Sydney/en/Colors_in_FireMonkey то, что Вы указали Color:=0 - так это нулевой цвет, с нулевой прозрачностью, что Вы ожидали увидеть?
-
Так Вам шашечки или ехать? Если Вы рисуете на канве, то какие стили могут быть? Для канвы я Вам пример дал, там есть все про цвет выделенной ячейки. Если Вы хотите попробовать использовать стили, то примерно это должно выглядеть так Stringgrig.StylesData['background.content.selection.Fill.Color'] := Color; Но это не точно, надо пробовать А где увидеть, что именно используется из стиля я не знаю, может кто еще подскажет. По стилям есть видеоуроки от Ярослава Бровина, посмотрите, может там будет ответ
-
если я правильно понимаю, то импортирование функций идет по имени, соответственно использовать библу без описания не получится. av_get_channel_layout_string:procedure(buf : PAnsiChar;buf_size : Integer;nb_channels : Integer;channel_layout : int64_t) ; cdecl; @av_get_channel_layout_string:=SafeGetProcAddress(AVUtilHandle, 'av_get_channel_layout_string');
-
Sascha отреагировал на ответ на вопрос: Кто подключил к Firemonkey-проекту библиотеки, написанные на других языках?
-
Ну я везде использую свою отрисовку, поэтому у меня такой проблемы не стоит, все таблички выглядят одинаково
-
может надо вместо JsonToSend.WriteString(Memo3.Text); писать JsonToSend.WriteString(TNetEncoding.Base64String.Encode(Memo3.Text)); Подключить юнит System.NetEncoding
-
Только с рисованием. Используй GridDrawColumnCell procedure TForm2.GridDrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State: TGridDrawStates); const HorzTextMargin = 2; VertTextMargin = 1; var TextLayout: TTextLayout; TextRect: TRectF; el_id: Integer; i: Integer; el_type: Integer; begin TextRect := Bounds; TextRect.Left := TextRect.Left + 1; TextRect.Bottom := TextRect.Bottom - 1; TextRect.Inflate(-HorzTextMargin, -VertTextMargin); if TGridDrawState.RowSelected in State then Canvas.Fill.Color := form1.Style.SelectCellColor else Canvas.Fill.Color := TAlphaColors.white; Canvas.FillRect(Bounds, 0, 0, AllCorners, 1); if Value.IsEmpty = false then begin TextLayout := TTextLayoutManager.DefaultTextLayout.Create; try TextLayout.BeginUpdate; try TextLayout.WordWrap := false; TextLayout.Opacity := Column.AbsoluteOpacity; TextLayout.HorizontalAlign := TTextalign.Leading; TextLayout.VerticalAlign := TTextalign.Center; TextLayout.Trimming := TTextTrimming.Character; TextLayout.TopLeft := TextRect.TopLeft; TextLayout.Text := Value.ToString; TextLayout.MaxSize := PointF(TextRect.Width, TextRect.Height); el_type := 0; //условие и т.д. if el_type = 0 then TextLayout.Color := form1.Style.OsveshenieColor else if el_type = 1 then TextLayout.Color := form1.Style.KlimatColor else if el_type = 2 then TextLayout.Color := form1.Style.BezopasnostColor else if el_type = 3 then TextLayout.Color := form1.Style.OhranaColor else if el_type = 4 then TextLayout.Color := form1.Style.UstroystvaColor else if el_type = 5 then TextLayout.Color := form1.Style.UpravlenieColor else if el_type = 6 then TextLayout.Color := form1.Style.WifiColor else if el_type = 7 then TextLayout.Color := form1.Style.DopColor; { Пользовательские настройки отрисовки } // TextLayout.Font.Family := 'Times New Roman'; // TextLayout.Color := form1.Style.FontColor; TextLayout.Font.Size := form1.Style.FontSize; TextLayout.Font.Family := (Sender as TStringGrid).TextSettings.Font.Family; finally TextLayout.EndUpdate; end; TextLayout.RenderLayout(Canvas); finally TextLayout.DisposeOf; end; end; end;