Page 1 of 1
Mini Gauges
Posted: Thu Jul 16, 2020 7:09 am
by l1marik
Mini Gauges
Task was clear, to make minimalist gauges of icon size
Source:
http://www.ctvrtky.info/wp-content/uplo ... Gauges.tar
Re: Mini Gauges
Posted: Thu Jul 16, 2020 1:55 pm
by ebs
l1marik,
I love your series of gauges - please keep them coming! One question:
Why is the statement
in the drawing loop in the procedure
ImageToColor()? I commented it out and it has no effect.
Regards,
Eric
Re: Mini Gauges
Posted: Thu Jul 16, 2020 3:11 pm
by infratec
You should definately use EnableExplicit.
To avoid an error you should use some checks:
Code: Select all
If IsGadget(parent_canvas)
If GadgetWidth(parent_canvas) > 0
If StartVectorDrawing(CanvasVectorOutput(parent_canvas))
Else if you reduce the window to the titlebar it results in an error.
And why not 'own' gadgets instead of drawing?
Than you can avoid the resizing commands. This can be done automatically. (If you want it)
Re: Mini Gauges
Posted: Fri Jul 17, 2020 6:35 am
by l1marik
ebs wrote:l1marik,
I love your series of gauges - please keep them coming! One question:
Why is the statement
in the drawing loop in the procedure
ImageToColor()? I commented it out and it has no effect.
Regards,
Eric
Dear Eric, it is some rest in the code, thank you for notice.
Lukas
Re: Mini Gauges
Posted: Fri Jul 17, 2020 6:39 am
by l1marik
infratec wrote:You should definately use EnableExplicit.
To avoid an error you should use some checks:
Code: Select all
If IsGadget(parent_canvas)
If GadgetWidth(parent_canvas) > 0
If StartVectorDrawing(CanvasVectorOutput(parent_canvas))
Else if you reduce the window to the titlebar it results in an error.
And why not 'own' gadgets instead of drawing?
Than you can avoid the resizing commands. This can be done automatically. (If you want it)
Dear infratec, answer is simple, for demo I wrote code as minimally needed, without any extra checking. For final application it is different story.
Lukas
Re: Mini Gauges
Posted: Fri Jul 17, 2020 12:20 pm
by Saki
Hi,
Codes for the forum should always be as perfect as possible.
Beginners look at the codes or take them over completely.
Bad programming style is thus inherited.
Therefore, always document the codes well.
EnableExplicit is a "Must have" for every code that is made available to others.
Only beginners or unteachable people do without it.
There are then quickly no more answers or ratings from other users.
The interest in such codes diminishes very quickly.
The problem with the low priority of the window timers can unfortunately
not be solved by using BindEvent() it just shift the problem a little.
If you want to use window timers, it is best to set only one.
This one can then be divided into several.
Using threads forces the user to create a thread safe executable, so I avoid this completely.
If you want to do this, you are probably more experienced and can add it yourself.
But for the cyclic execution of a multi timer it is not necessary, at least not for my code.
Best Regards Saki