Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Problem/Questions - QT

I really think my code is correct now after studying docs, samples and camera sample. I just cannot understand why the native screen is not visible. I have even just blitted another color at the end of initConnectionScreen() and still there is just a red square (my QMainWindow - 200 x 200) and the rest is dark background. I don't even see the blitted color.

 

Can anyone please suggest something to try because even RIM development advisor said this is possible so I cant understand why i dont see the screen.h over my QMainWindow.

 

void initConnectionScreen()
{
	int rc = screen_create_context(&screen_cxt, 0);
	
	
	screen_create_window_type(&connection_screen_window, screen_cxt, SCREEN_CHILD_WINDOW);
	char* idArr = "HelloForeignWindowAppID";
	char* groupArr = "cameraViewfinder";
	screen_join_window_group(connection_screen_window, groupArr);
	screen_set_window_property_cv(connection_screen_window, SCREEN_PROPERTY_ID_STRING, strlen(idArr), idArr);
	int video_size[] = { 1024,600 };
	screen_set_window_property_iv(connection_screen_window, SCREEN_PROPERTY_BUFFER_SIZE, video_size);
	screen_set_window_property_iv(connection_screen_window, SCREEN_PROPERTY_SOURCE_SIZE, video_size);
	cout << "init connection screen";
	cout.flush();
	int z = 10;
	screen_set_window_property_iv(connection_screen_window, SCREEN_PROPERTY_VISIBLE, &z);

	int pos[] = { 0, 0 };
	screen_set_window_property_iv(connection_screen_window, SCREEN_PROPERTY_POSITION, pos);

	screen_create_window_buffers(connection_screen_window, 1);

	screen_pixmap_t screen_pix;
	screen_create_pixmap(&screen_pix, screen_cxt);

	int usage2 = SCREEN_USAGE_WRITE | SCREEN_USAGE_NATIVE;
	int format2 = SCREEN_FORMAT_YUV420;;
	screen_set_pixmap_property_iv(screen_pix, SCREEN_PROPERTY_USAGE, &usage2);

	
	screen_set_pixmap_property_iv(screen_pix, SCREEN_PROPERTY_FORMAT, &format2);

	screen_set_pixmap_property_iv(screen_pix, SCREEN_PROPERTY_BUFFER_SIZE, video_size);

	screen_create_pixmap_buffer(screen_pix);


	screen_get_pixmap_property_pv(screen_pix, SCREEN_PROPERTY_RENDER_BUFFERS, (void**) &connection_screen_pixel_buffer);


	screen_get_buffer_property_iv(connection_screen_pixel_buffer, SCREEN_PROPERTY_STRIDE, &stride);
	int attribs[] = { SCREEN_BLIT_COLOR, 0xffffff, SCREEN_BLIT_END };
	screen_buffer_t screen_buffer;
	screen_get_window_property_pv(connection_screen_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void**) &screen_buffer);

	//int attribs[] = { SCREEN_BLIT_SOURCE_WIDTH, 900, SCREEN_BLIT_SOURCE_HEIGHT, 500, SCREEN_BLIT_END };
	screen_blit(screen_cxt, screen_buffer, connection_screen_pixel_buffer, attribs);

	int dirty_rects[] = { 0, 0, 1024, 600 };
	screen_post_window(connection_screen_window, screen_buffer, 1, dirty_rects, 0);
	printf("fin init connection screen \n");
	fflush( stdout );
	 int visible = 1;
	screen_set_window_property_iv(connection_screen_window, SCREEN_PROPERTY_VISIBLE, &visible);

	    // There is a bug in ForeignWindow in 10.0.6 which defers window context
	    // flushing until some future UI update.  As a result, the window will
	    // not actually be visible until someone flushes the context.  This is
	    // fixed in the next release.  For now, we will just manually flush the
	    // window context.
	    screen_context_t ctx;
	    screen_get_window_property_pv(connection_screen_window, SCREEN_PROPERTY_CONTEXT, (void**) &ctx);
	    screen_flush_context(ctx, 0);

}