Formatted Text in Editor Gadget

Linux specific forum
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Formatted Text in Editor Gadget

Post 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
Image Image
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post 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
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post by WishMaster »

What does this tell me?
Doesn't PB submit the strings properly?
Image Image
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post by WishMaster »

Why is it always me who doesn' get any answers?
Am I too stupid to ask proper questions?
Image Image
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post 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...
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Post by bembulak »

Hm, Wishmaster, have you solved the problem? Is it possible to see example code?
Thanks.
cheers,

bembulak
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post 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.
Image Image
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Post by bembulak »

Image

I feel very sorry for you.

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

bembulak
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post by WishMaster »

Image Image
Post Reply