Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to call GUI in static function?
How to call GUI in static function? [message #12785] Fri, 16 November 2007 09:36 Go to next message
LiniX is currently offline  LiniX
Messages: 7
Registered: October 2007
Location: Thailand
Promising Member
Hi,

i have a little problem.
in my static function (static void Project::on_call()).
this static function is active when have someone call to me.
(i make Softphone)

when have someone call to me, i want the popup window to show who call to me and show "Accept" or "Reject" like X-Lite or Skype.

So..

static void Project::on_call(){

//CODES

if(PromptOKCancel("Accept?")){
    /* answer incoming calls with 200/OK */
    		pjsua_call_answer(call_id, 200, NULL, NULL);
    }
}


it build complete, But when i use program when someone call to me, the programe is crash. and it say

(<unknown>:7856): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_screen: assertion `GDK_IS_SCREEN (screen)' failed

(<unknown>:7856): Gdk-CRITICAL **: gdk_drawable_set_colormap: assertion `GDK_IS_DRAWABLE (drawable)' failed

(<unknown>:7856): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE (drawable)' failed

(<unknown>:7856): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(<unknown>:7856): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
Segmentation fault (core dumped)

and Program is crash.

sometime is
Xlib: unexpected async reply (sequence 0x20a7)!

GUI is crash but function is working

so i use Layout to static function
in Project.h

class Project : public WithTopLayout<TopWindow>{
	WithAccountLayout<TopWindow> account;
	WithRingLayout<TopWindow> ringer;	
        ...
        ...

static void Project::on_call(){

//CODES

ringer.Execute();

but build incomplete, it say
...
/home/watchara/upp/MyApps/Project/Project.h:19: error: invalid use of member ‘Project::ringer’ in static member function
/home/watchara/upp/MyApps/Project/Project.cpp:62: error: from this location
...


How to use PromptOKCancel,Layout in static function ?

Thank You Very Much
Watchara Kangkun
Stupid Man
Re: How to call GUI in static function? [message #12786 is a reply to message #12785] Fri, 16 November 2007 11:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
LiniX wrote on Fri, 16 November 2007 03:36

Hi,

i have a little problem.
in my static function (static void Project::on_call()).
this static function is active when have someone call to me.
(i make Softphone)

when have someone call to me, i want the popup window to show who call to me and show "Accept" or "Reject" like X-Lite or Skype.

So..

static void Project::on_call(){

//CODES

if(PromptOKCancel("Accept?")){
    /* answer incoming calls with 200/OK */
    		pjsua_call_answer(call_id, 200, NULL, NULL);
    }
}


it build complete, But when i use program when someone call to me, the programe is crash. and it say

(<unknown>:7856): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_screen: assertion `GDK_IS_SCREEN (screen)' failed

(<unknown>:7856): Gdk-CRITICAL **: gdk_drawable_set_colormap: assertion `GDK_IS_DRAWABLE (drawable)' failed

(<unknown>:7856): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE (drawable)' failed

(<unknown>:7856): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(<unknown>:7856): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
Segmentation fault (core dumped)

and Program is crash.

sometime is
Xlib: unexpected async reply (sequence 0x20a7)!

GUI is crash but function is working

so i use Layout to static function
in Project.h

class Project : public WithTopLayout<TopWindow>{
	WithAccountLayout<TopWindow> account;
	WithRingLayout<TopWindow> ringer;	
        ...
        ...

static void Project::on_call(){

//CODES

ringer.Execute();

but build incomplete, it say
...
/home/watchara/upp/MyApps/Project/Project.h:19: error: invalid use of member ‘Project::ringer’ in static member function
/home/watchara/upp/MyApps/Project/Project.cpp:62: error: from this location
...


How to use PromptOKCancel,Layout in static function ?

Thank You Very Much
Watchara Kangkun
Stupid Man


I am sorry, the description is far confusing. Do you think you could create a simple testcase to demonstrate the problem?

Mirek
Re: How to call GUI in static function? [message #12791 is a reply to message #12786] Fri, 16 November 2007 14:48 Go to previous messageGo to next message
LiniX is currently offline  LiniX
Messages: 7
Registered: October 2007
Location: Thailand
Promising Member
Sorry Mirek,

I mean, I call use PromptOKCancel in static void Project::on_call() and my program is crash!

I want to know,
How to use PromptOKCancel in static function without crash ?

Thank You Very Much
Watchara Kangkun
Re: How to call GUI in static function? [message #12796 is a reply to message #12791] Sat, 17 November 2007 10:33 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
LiniX wrote on Fri, 16 November 2007 08:48

Sorry Mirek,

I mean, I call use PromptOKCancel in static void Project::on_call() and my program is crash!

I want to know,
How to use PromptOKCancel in static function without crash ?

Thank You Very Much
Watchara Kangkun


Well, it should not crash in the first place.

If it does, there are two possible explanations:

- something else is wrong with your code - hard to say what

- there is a bug in U++

I guess that by creating a simple testcase, you can investigate both alternatives. If second one proves true, posting a testcase here will significantly speedup the fix.

Mirek
Previous Topic: Have the PictureButton ?
Next Topic: Using RichEdit in dialog
Goto Forum:
  


Current Time: Mon Apr 29 09:14:45 CEST 2024

Total time taken to generate the page: 0.03200 seconds