Giter VIP home page Giter VIP logo

Comments (7)

KngStr avatar KngStr commented on May 29, 2024

Int32是4字节,TAlphaColor也是4字节
不会溢出。
你有崩溃的例子嘛?

from fmxui.

qq143626 avatar qq143626 commented on May 29, 2024

UI.Utils.pas中的HtmlColorToColor方法中,如果颜色指定为color=''#303030''或color=''303030''时,会分别调用到调用下面两行语句
第878行Result := StrToIntDef('$ff' + Copy(S, 2, Length(S) - 1), 0)
第903行if (Length(s) = 6) then result := StrToIntDef('$ff' + s, 0)
StrToIntDef方法会将$ff303030转为-13619152,而返回值TAlphaColor的类型是type Cardinal,数字越界导致的程序崩溃
建议这两个方法将'$ff'改成'$',或者用StrToUIntDef

from fmxui.

qq143626 avatar qq143626 commented on May 29, 2024

另外这个错误只有在动态赋值的时候才会出现,设计期直接指定的话运行没问题

from fmxui.

KngStr avatar KngStr commented on May 29, 2024

ShowMessage(IntToHex(HtmlColorToColor('#303030')));
未测试到崩溃,最终的数值也不错。
不过确实是用StrToUIntDef好些,已更新。
感谢反馈

from fmxui.

qq143626 avatar qq143626 commented on May 29, 2024

是我的错,程序崩溃是因为在FormCreate中
,属于Application.Error,让我误以为是崩溃,在ButtonView1Click中只是Error,所以只是弹出错误框,我之前都是在窗体显示前修改的HtmlText,没有测试窗体显示后修改HtmlText,所以才说崩溃
QQ截图20220213151834
QQ截图20220213151932

from fmxui.

KngStr avatar KngStr commented on May 29, 2024

这就奇怪了。我也经常这样赋值,没遇到过错误

from fmxui.

qq143626 avatar qq143626 commented on May 29, 2024

那就不清楚了,要不就是delphi版本的问题,要不就是编译开关的问题,我这边是xe11,编译开关没改过

from fmxui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.