Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
There is no timetable.
2
General / Re: Dynarray initialization pattern
« Last post by PascalDragon on Today at 02:12:47 pm »
Do you happen to know if DFA knows/counts this "assignment"? Not neccessarily for optimization, but for the initialized logic checks.

This is completely unrelated to the DFA.

the only exception i know is with managed types with a range not starting with zero.
managed types always initialize to all zero's or empty so can cause a range check error.
other than that, it has no corner cases, and besides my remark, the memory is initialized.

The value might not always be valid, especially with managed records, but it will always be deterministic.
3
Beginners / Re: Program loop "runaway" while waiting on keyboard inputs
« Last post by Thaddy on Today at 02:10:29 pm »
The while loop needs an application.processmessages inside, because otherwise the loop keeps running without communication with the rest of the application. In a console/terminal app I would use a thread in its simplest form. I can give you an example for that. Not now, but soon. I have to check wether peekmessage/dispatch message etc. are supported for Linux as well. On windows this is easy. On linux I expect that it is enough to include baseunix and call pause() in the loop. Pause will wait for an input signal before it continues and that includes keyboard signals of course.
4
Graphics / Re: STARS and Regular POLYGONS: Zorder type bug!
« Last post by Boleeman on Today at 02:05:38 pm »
Thanks KodeZwerg

Was drawing to TPaintbox, but I will need to try to draw internal on a TBitmap


Temp work around:
If the Polygon is smaller than the star then I found I could draw the star oversized, with the center polygon going on top automatically.

Also wanted to know how to save to svg, instead of png, Will probably need bgraBmp for that.
5
I'm working on a small application that has a main program loop, that monitors the value stored in a string buffer and does things based on the values of what happens to be in that buffer at any given time.

The application uses the OnKeyPress event handler which monitors keypresses and stores either a single character, a string, or a password in the buffer (depending on what the user is doing).

The problem is, the main loop seems to get "hung up" and doesn't even get the application's window to the point where it's visible.  I have to kill it using the System Monitor (on ubuntu).

The main loop is essentially:
Code: [Select]
while (1) do begin
   if (buffer = (something I care about) do_something
   if (buffer = (something else that I care about) do_something_else
   etc.
   etc.
end;

If I remove the while loop, the stuff inside it works fine, although (as expected) only one time.

What is wrong in my thinking here?  Thanks.
6
General / Re: how to change the color font and background of a button
« Last post by cdbc on Today at 12:02:27 pm »
Hi
To add to @KodeZwerg's statement above, here's a screenshot of an app under development, where all the buttons are made with TPanels...
As a bonus i've attached the source aswell  :D
Regards Benny
7
Hello,

Thank you for the response. I have updated the code and you'll find the screenshot attached. In my program, the font can be chosen by the user. In the pictures above, I used Arial as well.

Regarding setting the line distance, you can use TextMultiline function and specify the paragraph spacing. However this is applied when encountering end of line characters, not when the text is over the width of the rectangle and wraps. I've added an example in the code above.
That's already good! Would it also be possible to measure the height of such a TextBox created with Multiline?

Otherwise a feature to specify line spacing in general could be added.
That would be great! Especially if it would be possible to set the line distance and paragraph distance separately.
8
My guess is that the correct fix is the following:

Code: Pascal  [Select][+][-]
  1.     function RoundExDouble(x: Double): Double;
  2.     begin
  3.       x := x * 10; // in two steps to call the proper Ceil(double) overload
  4.       Result := Ceil(x) / 10;
  5.     end;

A cleaner approach would be to stay away from "currency" here, which is confusing, and works by chance.
9
Graphics / Re: STARS and Regular POLYGONS: Zorder type bug!
« Last post by KodeZwerg on Today at 11:13:35 am »
I have not downloaded your source, just watched images, this would be my way to control the drawing including z-order:
As always I would draw internal on a TBitmap :-D
Offer to set background color somewhere.
Offer to choose (inner/outer) color somewhere.
Offer to choose element style (star/polygon/whatever) somewhere.
Realize drawing by using an array of TShapes, the index will be than the z-order.
That way you could add drag/drop support for elements or tweak the z-order by moving the indexes.
Finally draw the array to TBitmap and assign it to whatever control you are painting onto.
10
General / Re: Free AI to use in local
« Last post by Thaddy on Today at 11:05:25 am »
BTW I am willing to share my code, but that is basically the same as one of schuler's examples. The data would be useless to others because it is trained based on data for my particular household.
OTOH I'll see if I can create some examples for fuzzy logic. That is much less data intensive and a good introduction to a form of AI that many people can start using right away.
scores:
cat                100% out of 1
me                100% out of 1
dogs               90% out of 2
female voices   88% out of 3

rates                92.0% from about 350 samples times 7.
Raw sample data at 48000 hz is about 2GB
4096 point fft's on the raw data makes up the rest.
The fft's are the data for the model, but it should be possible to train the model on the raw data at the cost of quite a lot more samples and longer processing time. have not tried that yet.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018