Re: more on g_strconcat problem

2003-11-26 Thread James M. Cape
On Wed, 2003-11-26 at 23:30, Carl B. Constantine wrote:
> Ok, I've definately nailed the problem down to an issue with the check
> button in my data entry box. But it still doesn't make sense. consider
> the following code:

[snip]

> sql = g_strconcat("insert into customers (id_req) values('", toggleTest, "')",0L);

[snip]

I'm not really informed on whether NULL is ever != 0, but have you tried
terminating the string with NULL instead of "0L"?

-- 
Peace,

Jim Cape
http://ignore-your.tv

"It is literally true that, like Christianity, Socialism
 has conquered the world by defeating itself."
-- Alexander Berkman, ABC of Anarchism


signature.asc
Description: This is a digitally signed message part


more on g_strconcat problem

2003-11-26 Thread Carl B. Constantine
Ok, I've definately nailed the problem down to an issue with the check
button in my data entry box. But it still doesn't make sense. consider
the following code:

idRequired = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(customers, 
"cust_id_req")));
  g_print("ID Required status: %d\n", idRequired);
  
  toggleTest = (gint)idRequired;
  g_print("ID Required status: %d\n", toggleTest);

the above code prints 0 if the checkbox is unchecked and 1 if it is
checked. 

With that in mind, consider the following additional code:

sql = g_strconcat("insert into customers (id_req) values('", toggleTest, "')",0L);

  g_print("First sql: %s\n",sql);

This code prints the following when the checkbox is unchecked:

insert into customers (id_req) values('

so it doesn't even complete the string. That same code crashes with a
segfault 11 if I check the checkbox in the dialog.

This makes absolutely NO sense what so ever!

Please help, this is driving me NUTSO!

-- 
 .''`.  Carl B. Constantine
: :' : [EMAIL PROTECTED]
`. `'GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom
  "Claiming that your operating system is the best in the world because more
  people use it is like saying McDonalds makes the best food in the world."
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


urgent help needed: strange problem with g_strconcat

2003-11-26 Thread Carl B. Constantine
I'm having a REALLY strange thing happen with g_strconcat. I'm using it
build up a SQL query to insert data into a database. The call works fine
until I add one more field, then g_strconcat blows up and causes a
segfault, this is BEFORE I even get a chance to make the sql query, I
can't even print out the resulting string to double-check what it looks
like. g_strconcat just blows up in my face!

Here is the code that works:

/* Contruct an SQL command from the data available in the customer
 entry dialog. This is long, but needs to be done this way.
  */
  
  sql = g_strconcat("insert into customers (customer_id, entry_date, title, last_name, 
first_name, \
  company, address, suite, phone, postal_code, buzzer, zone, pymt_mthd, cc_num, \
  account_code, acct_start, acct_abbr, acct_status, acct_users, acct_restrictions, 
\
  co_nicks, id_type, special) \
  values('", gtk_label_get_text(GTK_LABEL(lookup_widget(customers, 
"customer_number"))), "',\
  '",gtk_label_get_text(GTK_LABEL(lookup_widget(customers, "cust_entry_date"))), 
"',\
  '",gtk_entry_get_text(GTK_ENTRY(title->entry)),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"last_name_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"first_name_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_company_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_address_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_suite_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_phone_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_postal_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_buzzer_code"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_zone_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(payment->entry)),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, "credit_card_no"))),"', 
\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_account_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"acct_start_date"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"acct_abbr_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(status->entry)),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"auth_acct_users"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_restrict_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, "co_alias_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_idtype_entry"))),"',\
  '",specialText,"')",0L);
  
  g_print("SQL Query: %s\n",sql);


Here is the code that segfaults even before the g_print (note the
addtion of id_req to the sql query):

/* Contruct an SQL command from the data available in the customer
 entry dialog. This is long, but needs to be done this way.
  */
  
  sql = g_strconcat("insert into customers (customer_id, entry_date, title, last_name, 
first_name, \
  company, address, suite, phone, postal_code, buzzer, zone, pymt_mthd, cc_num, \
  account_code, acct_start, acct_abbr, acct_status, acct_users, acct_restrictions, 
\
  co_nicks, id_req, id_type, special) \
  values('", gtk_label_get_text(GTK_LABEL(lookup_widget(customers, 
"customer_number"))), "',\
  '",gtk_label_get_text(GTK_LABEL(lookup_widget(customers, "cust_entry_date"))), 
"',\
  '",gtk_entry_get_text(GTK_ENTRY(title->entry)),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"last_name_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"first_name_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_company_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_address_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_suite_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_phone_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_postal_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_buzzer_code"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_zone_entry"))),"', \
  '",gtk_entry_get_text(GTK_ENTRY(payment->entry)),"', \
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, "credit_card_no"))),"', 
\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"cust_account_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"acct_start_date"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(lookup_widget(customers, 
"acct_abbr_entry"))),"',\
  '",gtk_entry_get_text(GTK_ENTRY(status->entry)),"', 

spreadsheet

2003-11-26 Thread Bernhard . Rumpler
Hi all,

I want to create a spreadsheet-like user interface.
As there exists no spreadsheet in gtk, I think the
only way to get something spreadsheet-like in limited
time is to use a table, e.g. with buttons representing
the column headings and entries representing cells.

Has anyone any ideas what would be the easiest way 
to make the "columns" resizeable with the mouse?

thanks for any hints,
Bernhard
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


jerky viewport scrolling performance GTK+

2003-11-26 Thread Lambert Schomaker
Hi,

 I am new to GTK+ so the question may be dumb.
We are buidling an image viewer / annotator using glade-2:
glade-2 1.1.3
libgtk-1.2.so.0.9.1
libgtk-x11-2.0.so.0.200.1
libpango-1.0.so.0.200.1
libpangoxft-1.0.so.0.200.1
libgcc_s-3.2.2-20030225.so.1
Hardware: 3 GHz/1 GB.
OS: Linux RH 9.
When using a simple window with one viewport and an embedded gtkimage, 
scrolling is very
jerky (20MB greyscale image), just using out-of-the box glade with very 
little adaptation of
callback.c. The .tif file is loaded in a pixbuf (once),  the pixbuf is set 
into the gtkimage (once).
Horizontal scrolling is reasonable, vertical scrolling is a drama.
Looking at the same image with eog (eye of gnome), scrolling is superbly 
smooth.
Using gtkviewer, scrolling of the same image is somewhat slower but still 
better than our
homebrew thing. I also noticed that event transmission to the window manager 
(e.g. start resize
or drag window) is sluggish. Resident memory of this small application  
(indicated by top): 76 MB.
Idle cpu load is higher than normal. Replacing gtk_main by an event 
iteration loop
with usleep(1000)  (1ms) as a 'yield' did not give noticable improvement or 
deterioration.
No hand-coded event handling has been added on top of the pre-cooked event 
handling.

Where is the trick? Apparently we are missing some point...

Lambert Schomaker

_
MSN Search, for accurate results! http://search.msn.nl
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list