Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 8:50 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Dec 02, 2010 11:38 am 
Offline

Joined: Tue Nov 18, 2008 11:59 am
Posts: 19
Hi -
I'm porting code from a G55 to G56 terminal due to my customer's desire to add color to the GUI.
I'm trying to draw a partial ellipse with a specified color (red in this instance).

I'm using the following code:
drawellipse(xcenter,ycenter,radius,0,0,start_angle_rads, end_angle_rads,ELLIPSE_FILL AND ELLIPSE_CONNECT_CENTER)

I have bgcolor set to a named color that is defined as 224 and
bordercolor is set to the same. 224 appears to be red.

When I run the simulator the drawn object has a white border and black fill.
The simulator is set to QTERM-G56 and display is set for Color (enhanced TFT).

I've also tried with the ellipse_flags set to only ELLIPSE_CONNECT_CENTER and got the same result.
Any ideas?
Thanks in advance,
JET4


Top
 Profile  
 
PostPosted: Thu Dec 02, 2010 1:03 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
Attached is an example of drawing a red ellipse. The code is:

Code:
func Draw (pass as boolean)
    handles MSG_DRAW
    dim xcenter, ycenter, radius, start_angle_rads, end_angle_rads as float

    if pass then
        return
    endif
    xcenter := 100
    ycenter := 100
    radius := 50
    start_angle_rads := 0
    end_angle_rads := 2*pi
    SetBGColor(224)
    SetFGColor(224)

    drawellipse(xcenter,ycenter,radius,0,0,start_angle_rads, end_angle_rads, ELLIPSE_FILL AND ELLIPSE_CONNECT_CENTER)
    return
endfunc


Attachments:
draw_red_ellipse.qly [5.38 KiB]
Downloaded 181 times

_________________
Ron L.

http://www.beijerelectronicsinc.com/
Top
 Profile  
 
PostPosted: Thu Dec 02, 2010 1:12 pm 
Offline

Joined: Tue Nov 18, 2008 11:59 am
Posts: 19
Thanks Ron.

I added the SetBGColor to my code and this made all the difference.

Question: How is the SetBGColor different from setting bgcolor in the object properties in the Layout View?

Thanks again.

JET4


Top
 Profile  
 
PostPosted: Thu Dec 02, 2010 1:18 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
Typically you would only call SetBGColor if you are creating your own object or editing an object template. At some point every object calls the function SetBGColor before drawing. If you just want a red ellipse there is no need to call SetBGColor, you would just create an ellipse object and set its BGColor property to 224. Also the BGColor property allows you to use a named color which allows you to change the look and feel of an entire workspace using Themes. But at some point before the Ellipse object draw's itself, it calls the SetBGColor API. But if you're not designing objects, you really don't need to worry about ever using that API, just create objects and change there properties to do what you want.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group