Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - create and delete widget: (7 Items)
   
create and delete widget  
hello everyone,

I am new in GUI, how to create and delete widget using script ?

thank you.

best regards
afif
Re: create and delete widget  
Hi Afif,
Please specify what do you mean by script: shell script or program code?

There are two basic ways to create a widget: using Photon Application Builder (PhAB) or  using c/c++ code in your 
program.

For PhAB see:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_prog_guide%2Fwidgets.html&cp=17_0_6

For code see:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_prog_guide%2Fwgt_code.html&cp=17_0_12


Best regards,
Fedor
Re: create and delete widget  
I don't understand how to use the code, I want to create an image as label and the picture is in my directory.
Re: create and delete widget  
You can use PxLoadImage() and then PtSetResource() with Pt_ARG_LABEL_IMAGE flag.
E.g.
PhImage_t *my_image;
my_image = PxLoadImage(“/home/my_pict.jpg”, NULL);
PtSetResource( ABW_my_label, Pt_ARG_LABEL_IMAGE, my_image, 0 );


For more information please read following help topics about PtLabel and PhImage_t:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_widget_ref%2Fptlabel.html&cp=17_2_2_32
and
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_lib_ref%2Fph%2Fphimage_t.html&cp=
17_1_9_55 .



Best regards,
Fedor
Re: create and delete widget  
my script is like this :

 my_image= PxLoadImage("/home/PSR.jpg",NULL);
 my_label=PtCreateWidget(PtLabel,Pt_NO_PARENT,1,args);
 PtSetResource( ABW_my_label, Pt_ARG_LABEL_IMAGE, my_image, 0 );

but it's error because my_label is not define. what should I do? 

Thank you.
Re: create and delete widget  
and I get error Pxloadimage is undefined.

does anyone know the reason? 

thank you
Re: create and delete widget  
Hi Afif,

> my script is like this :
> 
>  my_image= PxLoadImage("/home/PSR.jpg",NULL);
>  my_label=PtCreateWidget(PtLabel,Pt_NO_PARENT,1,args);
>  PtSetResource( ABW_my_label, Pt_ARG_LABEL_IMAGE, my_image, 0 );
> 
> but it's error because my_label is not define. what should I do? 
> 
> Thank you.

PtLabbel requires parent widget. 
For more information please read:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_prog_guide%2Fnonphab.html&cp=17_0_27

http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_lib_ref%2Fpt%2Fptcreatewidget.html&cp=17_1_13_101

http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.photon_lib_ref%2Fpt%2Fptsetparentwidget.html&cp=17_1_13_228

> and I get 
error Pxloadimage is undefined.
> 
> does anyone know the reason? 
> 
> thank you

You have to include phexlib library in your common.mk.
E.g.
LIBS += phexlib

Best regards,
Fedor