Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:32 23 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help with MMBASIC Bar Gauge control

Author Message
Cremo
Newbie

Joined: 21/07/2015
Location: Italy
Posts: 36
Posted: 09:23am 25 Sep 2024
Copy link to clipboard 
Print this post

Hi I have this problem: I need that the BARGAUGE control (in horizontal position) works in this way: the bar  position corresponding with the min value is to the right (and of course the position corresponding to the max value is to the left).
Any idea?
Thank you.
Pietro Cremonini
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6768
Posted: 10:30am 25 Sep 2024
Copy link to clipboard 
Print this post

Subtract your required value from the full scale reading and use the result.

e.g. if the max value is 100 and you want to show 20 from the right use 100-20 = 80 to draw the bar graph.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Cremo
Newbie

Joined: 21/07/2015
Location: Italy
Posts: 36
Posted: 02:14pm 26 Sep 2024
Copy link to clipboard 
Print this post

Hi Mixtel90, thank you for your  reply but it seems that my problem is not solved
Pietro
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6768
Posted: 02:46pm 26 Sep 2024
Copy link to clipboard 
Print this post

Normally you have (according to the manual)
GUI BARGAUGE #ref, StartX, StartY, width, height, Fcolour, Bcolour, min, max, c1, ta, c2, tb, c3, ct, c4
where ,c1,ta,c2,tb,c3,tc,t4 are optional

I assume you have a simple 2-colour horizontal bar gauge working but with min on the left and max on the right?

StartX and StartY set the top left position of the gauge.

To get it horizontal the width has to be greater than the height.

Fcolour and Bcolour are foreground and background colours.

min sets the minimum value and max sets the maximum value. These will be at the LH and RH ends of the bar.

#ref is the unique reference number that you've given this control.

You change the value on the bar by using something like
CtrlVal(#ref) = yourvalue

if you have min set to 0 and max set to 100 then

CtrlVal(#ref) = 20

will display a value of 20 on the bar (1/5 of the way along)

If you use
CtrlVal(#ref) = (100-20)

then the display will be at the 80 position.

(100-0) will put the display at the max end
(100-100) will put it at the min end.

Of course, the colours may be opposite to what you want but you can specify them.

Get an ordinary horizontal bar graph working first, even if the direction is wrong. If you are still having problems then please post a short piece of code that shows us what your problem is.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024