Skip navigation.
Home
The QNX Community Portal

View topic - problem about set own variables for PtLabel

problem about set own variables for PtLabel

Isn't the name clear?

problem about set own variables for PtLabel

Postby bzxaggio » Thu Oct 07, 2010 6:14 pm

hi
currently I'm developing a coordinate system in PhAB using PtLabel as x&y label. Question is I would like to use my own data to set PtLabel in order to change x&y scalar every time. Any one could help?

PS: I had used PtSetResource(ABW_x_axis, Pt_ARG_TEXT_STRING, "1.0",0), and it display 1.0 on screen. I would like to use an array to let PtLabel display the value of a[n]. Like if a[n]=10.0, then the label text should be 10.0 displayed in screen.
PtSetResource(ABW_x_axis, Pt_ARG_TEXT_STRING, a[1],0) does not work, so anyone have suggestions to me, thank you.
Last edited by bzxaggio on Thu Oct 07, 2010 11:38 pm, edited 2 times in total.
bzxaggio
Active Member
 
Posts: 16
Joined: Tue Aug 24, 2010 10:09 pm
Location: CHI

RE: problem about set own variables for PtLabel

Postby mario » Thu Oct 07, 2010 8:09 pm

What do you mean does not support variable?

Check the doc on PtSetResource it will explain what the 0 is.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: problem about set own variables for PtLabel

Postby bzxaggio » Thu Oct 07, 2010 8:49 pm

mario wrote:What do you mean does not support variable?

Check the doc on PtSetResource it will explain what the 0 is.


eg. If I have one array a[n] and the value of each unit changes per minute, so I want the PtLabel text to be a[1], a[2] and so on.
I tried PtSetResource(ABW_x_axis, Pt_ARG_TEXT_STRING, a[1],0), but it does not work, so I think the type of PtSetResource should bot be Pt_ARG_TEXT_STRING but something else, I do not know what it is.
bzxaggio
Active Member
 
Posts: 16
Joined: Tue Aug 24, 2010 10:09 pm
Location: CHI

RE: Re: RE: problem about set own variables for PtLabel

Postby mario » Fri Oct 08, 2010 3:32 am

How is a[n] defined?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: Re: RE: problem about set own variables for PtLabel

Postby bzxaggio » Fri Oct 08, 2010 4:01 pm

mario wrote:How is a[n] defined?



a[n] is an array, which changes every loop.
bzxaggio
Active Member
 
Posts: 16
Joined: Tue Aug 24, 2010 10:09 pm
Location: CHI

RE: Re: RE: Re: RE: problem about set own variables for PtLa

Postby mario » Fri Oct 08, 2010 5:10 pm

Deep breath.... I know it's an array you've said it before, i'm asking you how it is defined, int a[100], char a[100], float a[n], std::vector<char> a(n), char *a, etc.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: Re: RE: Re: RE: problem about set own variables for

Postby bzxaggio » Fri Oct 08, 2010 8:25 pm

mario wrote:Deep breath.... I know it's an array you've said it before, i'm asking you how it is defined, int a[100], char a[100], float a[n], std::vector<char> a(n), char *a, etc.


sry, it is a char array. Already solved using sprintf, Pt_ARG_TEXT_STRING can only support pointer, thank you guys!
bzxaggio
Active Member
 
Posts: 16
Joined: Tue Aug 24, 2010 10:09 pm
Location: CHI


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 2 guests