Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpGUI minor code improvement suggestions #128

Open
deanm73 opened this issue Jun 8, 2023 · 3 comments
Open

fpGUI minor code improvement suggestions #128

deanm73 opened this issue Jun 8, 2023 · 3 comments

Comments

@deanm73
Copy link

deanm73 commented Jun 8, 2023

These are small code improvements that might make the framework slightly more robust:

src/corelib/fpg_msgqueue.inc
procedure fpgInitMsgQueue;
after line "uMsgQueueList := TList.Create;"
add "uMsgQueueList.Capacity := cMessageQueueSize;"

procedure fpgDeliverMessage
replace "msg.Dest.Free"
with "FreeAndNil(msg.Dest)"

src/corelib/fpg_main.pas
procedure TfpgApplication.RunMessageLoop;
reduce timeout from "WaitWindowMessage(2000);"
to "WaitWindowMessage(100);"

src/corelib/fpg_widget.pas
procedure procedure TfpgWidget.MsgPaint
put code between "Canvas.BeginDraw;" and "Canvas.EndDraw" into try...finally

@ozznixon
Copy link

@graemeg - I would like to make some suggestions too. (I am in the process of migrating my whole software team to using fpGUI instead of Lazarus). In doing this, I have made 8 new styles (Luna, Charcoal, Olive, Silver, LightBlue, Chocolate, SlightPurple (Luna with matching RED to BLUE RGB values), OldMac).

I found, since 99% of the styles I am implementing, offer a "Gradient" for buttons, bars, etc. That TfpgStyle should have two additional properties (and wanted your feedback before I just dig in and start making changes):

.HasGradient:Boolean default False;
.DefaultDirection: default gdVertical;

  • This will allow my styles to be called, like:
    (** Using fpg_button as example **)
    if fpgStyle.HasGradient then
    fogStyle.DrawButtonFace(Canvas, r, gdHorizontal, lBtnFlags); // etc.

  • I am also porting over roughly 100 components:

  • Things like fpg_shortcutBar - a 32px height panel, for buttons that link to MENU choices.
    ( fpg_toolBar - a 64px .. 94px height panel - for BIG FLAT buttons - like UWP style apps).

  • Accordion, Dropdown Button, MultiColumn Combobox (like a lookup combobox), etc.

  • I am also takng a stab at porting over most of RxLIB components (where license allows).

Ozz Nixon

@ozznixon
Copy link

@graemeg -- Sorry, do not know how to use git to push these to you...

corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[1] := rsShortSun;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[2] := rsShortMon;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[3] := rsShortTue;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[4] := rsShortWed;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[5] := rsShortThu;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[6] := rsShortFri;
corelib/fpg_main.pas:DefaultFormatSettings.ShortDayNames[7] := rsShortSat;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[1] := rsLongSun;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[2] := rsLongMon;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[3] := rsLongTue;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[4] := rsLongWed;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[5] := rsLongThu;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[6] := rsLongFri;
corelib/fpg_main.pas:DefaultFormatSettings.LongDayNames[7] := rsLongSat;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[1] := rsShortJan;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[2] := rsShortFeb;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[3] := rsShortMar;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[4] := rsShortApr;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[5] := rsShortMay;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[6] := rsShortJun;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[7] := rsShortJul;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[8] := rsShortAug;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[9] := rsShortSep;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[10] := rsShortOct;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[11] := rsShortNov;
corelib/fpg_main.pas:DefaultFormatSettings.ShortMonthNames[12] := rsShortDec;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[1] := rsLongJan;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[2] := rsLongFeb;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[3] := rsLongMar;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[4] := rsLongApr;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[5] := rsLongMay;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[6] := rsLongJun;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[7] := rsLongJul;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[8] := rsLongAug;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[9] := rsLongSep;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[10] := rsLongOct;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[11] := rsLongNov;
corelib/fpg_main.pas:DefaultFormatSettings.LongMonthNames[12] := rsLongDec;

@ozznixon
Copy link

ozznixon commented Jan 25, 2025

  • Also added:
    Property Image to BaseButton and Button.

So Form code can do LoadImage_png('...');

  • Making Buttons much more "usable"... {IMHO}

Q1. Now, how do I make the loaded Image transparent???

Ozz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants