Page 1 of 1

Formatted Text in Editor Gadget

Posted: Sun Nov 05, 2006 11:57 am
by WishMaster
What's wrong here?

Code: Select all

OpenWindow(1, 1, 1, 200, 200, "")
CreateGadgetList(WindowID(1))
EditorGadget(1, 0, 0, 200, 200)

Buffer = gtk_text_view_get_buffer_(GadgetID(1))
gtk_text_buffer_set_text_(Buffer, "Some text here" + Chr(10) + "Some other line", Len("Some text here" + Chr(10) + "Some other line"))

gtk_text_buffer_create_tag_(Buffer, "style", "style", "PANGO_STYLE_ITALIC")
gtk_text_buffer_apply_tag_by_name_(Buffer, "style", 0, 10)

Repeat
   
Until WaitWindowEvent() = #PB_Event_CloseWindow

Posted: Sun Nov 05, 2006 3:45 pm
by oryaaaaa
Terminal log error
(purebasic.exe:11670): GLib-GObject-WARNING **: value "((PangoStyle) 134649400)" of type `PangoStyle' is invalid or out of range for property `style' of type `PangoStyle'

(purebasic.exe:11670): GLib-GObject-WARNING **: IA__g_object_set_valist: object class `GtkTextTag' has no property named `\x89\u0004$\xe8\xdch\u0001'

(purebasic.exe:11670): Gtk-CRITICAL **: gtk_text_buffer_apply_tag_by_name: assertion `start != NULL' failed

Posted: Mon Nov 06, 2006 1:28 pm
by WishMaster
What does this tell me?
Doesn't PB submit the strings properly?

Posted: Tue Nov 21, 2006 1:30 pm
by WishMaster
Why is it always me who doesn' get any answers?
Am I too stupid to ask proper questions?

Posted: Tue Nov 21, 2006 2:11 pm
by Trond
No, you simply ask hard questions, which means we can't simply tell you to RTFM if we don't know the answers.

Your function call:
gtk_text_buffer_apply_tag_by_name_(Buffer, "style", 0, 10)

The function declaration:
void gtk_text_buffer_apply_tag_by_name(GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *start, const GtkTextIter *end);

The error:
(purebasic.exe:11670): Gtk-CRITICAL **: gtk_text_buffer_apply_tag_by_name: assertion `start != NULL' failed

Conclusion:
Start can't be null (why I don't know), you passed 0 for start so an error is thrown.

Solution:
Pass another value for start.

Posted: Tue Nov 21, 2006 2:27 pm
by remi_meier
As Trond pointed out, you have to pass a pointer to a GtkTextIter to the
procedure, not actual values (also for const GtkTextIter *end).
const GtkTextIter *start

I hate Gtk...

Posted: Thu Dec 21, 2006 9:43 am
by bembulak
Hm, Wishmaster, have you solved the problem? Is it possible to see example code?
Thanks.

Posted: Thu Dec 21, 2006 2:46 pm
by WishMaster
Unfortunately, I didn't figure out how to use those TextIters. In addition, PB 4.0 Beta 1 doesn't even start here on OpenSUSE 10.2 with the latest NVidia drivers.

Posted: Thu Dec 21, 2006 3:06 pm
by bembulak
Image

I feel very sorry for you.

(Give Python + pygame a try... You'll be suprised.)

Posted: Wed Jan 03, 2007 12:46 am
by WishMaster