01-05-2013 05:11 AM
hello,
I am trying to use ComponentCanvas to make a button on top of video field.
but it is not drawing field on top of it.
It is adding componentcanvas field first and then adding videofield ; behaves like verticalfield manager.
so can any one give me proper way to use componentcanvas as I couldn't find any proper docs to use it.
thanks.
Solved! Go to Solution.
01-05-2013 09:00 AM
Here are the docs for OS 7.1. :
From a review of your problem description, are you actually adding the video field to the ComponentCanvas?
There are a few Threads that talk about ComponentCanvas, I recommend that you review these.
01-06-2013 04:52 AM - edited 01-06-2013 04:54 AM
Thanks peter_strange for your reply:
But I need example for using the componentcanvas.
i tried one of the demo example provided by RIM.
i found one code sample but it is not working for me as well.
if(_cameraField != null)
{
// Add the camera field to a new ComponentCanvas
ComponentCanvas compCanvas = new ComponentCanvas(Display.getWidth(), Display.getHeight());
compCanvas.add(_cameraField, 0, 0);
// Initialize GLField
// _glField = new DemoGLField(GL_FIELD_WIDTH, GL_FIELD_HEIGHT);
// _glField.setTargetFrameRate(GL_FRAME_RATE);
// Add the GLField to the canvas
abc=new RichTextField("karan Dubal");
compCanvas.add(abc, 100, 100);
// Add the ComponentCanvas to the screen
add(compCanvas);
}here glfield is commented which is in original RIM's Demo app and it is working fine but when i tried to put my own field like buttonfield/labelfield or richtextfield it is not working. camera field is overlapping other fields and richtextfield cannot be viewed.
01-06-2013 12:18 PM
I figure out the how to overlap buttonfield on camerafield.
I used ViewFinderOverlay for this purpose.
here is the code that i used:
if(_cameraField != null)
{
try{
overlay= new ViewfinderOverlay(_cameraField);//used viewfinderoverlay
overlay.getCanvas().add(new ButtonField("KD"));
add(overlay);
}
catch(Exception e){
final String msg=""+e;
Application.getApplication().invokeLater(new Runnable() {
public void run() {
// TODO Auto-generated method stub
Dialog.alert(msg);
}
});
}
}
else
{
add(new RichTextField("Error connecting to camera"));
}