Re: [gtk-list] clist woes



Ed Schreder wrote:

> Oops:)
>
> Ok this is my problem, I am writing a program which allows a user to
> browse a database, the user can either type in an item number or a
> description, if the user only types in a partial item # or description
> they get a list of items which are close the the item typed.  I am using
> a clist widget to display the list, my problem is that I can't seem to
> get the info from the selected row. What I am trying to do is copy the
> data to a structure which then sends the records data to a generic
> display widget I created.  I am using the clists gtk_clist_get_text()
> procedure but I keep getting seg faults when I try to either do a strcpy
> or an sprintf to the structures field, like this
>
> gtk_clist_get_text(GTK_CLIST(listwidget), row, column, &text);
> sprintf(myStruct->field, "%s", text);  <-- Crashes here
>
> I put this code in a signal for the clist "select row" event and return
> the structure which then gets used by an ok button.
>
> Does anyone have any ideas as to why I get the segfaults when I try to
> copy the text into my string?  Am I blind and just not seeing the reference
> here?
>
> Thanks
>

  I am working on a "similar" project.  It is a GNU order processing system.
I would take a look at testgtk.c in the gtk subdir of the gtk source tree.  I
have found it most helpful.  I am afraid I havent reached the point where I am
using code like you are attempting to do, but it is in there.

Good luck

Trever Adams
arabian@onramp.net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]