xml messaging

2007-03-16 Thread Kim Adil
I'm think about incorporating a communications feature into an app and I
want to send xml data between my gtk/glib network connected clients. If
you know of any convenient glib features or other libraries that are
coded in a similar or compatible style I would appreciate the suggestion.

Thanks,
Kim
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: custom treeview cell renderer advice

2007-01-30 Thread Kim Adil
Sorry about the visuals. Here is the question again with better spacing of 
example data.

I would like to write a custom cell renderer for a treeview and would
appreciate any advice you may offer. I want to be able to hide any
repeats cells that follow one another, with a few extra features. If
standard rendering of sample data in a treeview of fruit classifications
shows:

Color| Size| Variety
Red  |  1  |  a
Red  |  1  |  b
Green|  1  |  a
Green|  2  |  a
Green|  2  |  b
Yellow   |  1  |  a


then my new cell renderer would render it as:

Color| Size   | Variety
Red  |  1 |  a
 ||  b
Green|  1 |  a
 |  2 |  a
 ||  b
Yellow   |  1 |  a

But then if the user scrolls down one row it would look like:

Color| Size   | Variety
Red  |  1 |  b
Green|  1 |  a
 |  2 |  a
 ||  b
Yellow   |  1 |  a

So the very top row always shows the the value in the  list store.
Subsequent rows hide duplicate cells that are the same as cells
immediately above, unless the column to the left changes. It has the
effect of de-cluttering a table full of sorted/grouped data.

It is essentially what most database report writers (crystal & access)
do with a "hide duplicates" option
.
My initial thoughts are that I would have to maintain a few extra
columns based on:
(1) what row is at the top of the treeview,
(2) has the cell to the left of the cell being considered, changed from
last row to this row, and
(3) is the cell above a duplicate of the cell being considered.

Ideas and considered opinions would be much appreciated.

Thanks Kim



Kim Adil wrote:
> I would like to write a custom cell renderer for a treeview and would
> appreciate any advice you may offer. I want to be able to hide any
> repeats cells that follow one another, with a few extra features. If
> standard rendering of sample data in a treeview of fruit classifications
> shows:
>
> Color| Size   | Variety
> Red   |  1  |  a
> Red   |  1  |  b
> Green|  1  |  a
> Green|  2  |  a
> Green|  2  |  b
> Yellow  |  1  |   a
>
>
> then my new cell renderer would render it as:
>
> Color| Size   | Variety
> Red   |  1  |  a
>  |  |  b
> Green|  1  |  a
>  |  2  |  a
>  |  |  b
> Yellow  |  1  |   a
>
> But then if the user scrolls down one cell it would look like:
>
> Color| Size   | Variety
> Red   |  1  |  b
> Green|  1  |  a
>  |  2  |  a
>  |  |  b
> Yellow  |  1  |   a
>
> So the very top row always shows the the value in the  list store.
> Subsequent rows hide duplicate cells that are the same as cells
> immediately above, unless the column to the left changes. It has the
> effect of de-cluttering a table full of sorted/grouped data.
>
> It is essentially what most database report writers (crystal & access)
> do with a "hide duplicates" option
> .
> My initial thoughts are that I would have to maintain a few extra
> columns based on:
> (1) what row is at the top of the treeview,
> (2) has the cell to the left of the cell being considered, changed from
> last row to this row, and
> (3) is the cell above a duplicate of the cell being considered.
>
> Ideas and considered opinions would be much appreciated.
>
> Thanks Kim
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


custom treeview cell renderer advice

2007-01-30 Thread Kim Adil
I would like to write a custom cell renderer for a treeview and would
appreciate any advice you may offer. I want to be able to hide any
repeats cells that follow one another, with a few extra features. If
standard rendering of sample data in a treeview of fruit classifications
shows:

Color| Size   | Variety
Red   |  1  |  a
Red   |  1  |  b
Green|  1  |  a
Green|  2  |  a
Green|  2  |  b
Yellow  |  1  |   a


then my new cell renderer would render it as:

Color| Size   | Variety
Red   |  1  |  a
 |  |  b
Green|  1  |  a
 |  2  |  a
 |  |  b
Yellow  |  1  |   a

But then if the user scrolls down one cell it would look like:

Color| Size   | Variety
Red   |  1  |  b
Green|  1  |  a
 |  2  |  a
 |  |  b
Yellow  |  1  |   a

So the very top row always shows the the value in the  list store.
Subsequent rows hide duplicate cells that are the same as cells
immediately above, unless the column to the left changes. It has the
effect of de-cluttering a table full of sorted/grouped data.

It is essentially what most database report writers (crystal & access)
do with a "hide duplicates" option
.
My initial thoughts are that I would have to maintain a few extra
columns based on:
(1) what row is at the top of the treeview,
(2) has the cell to the left of the cell being considered, changed from
last row to this row, and
(3) is the cell above a duplicate of the cell being considered.

Ideas and considered opinions would be much appreciated.

Thanks Kim
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: WinXP & MSSQL & C & GTK+

2005-09-07 Thread Kim Adil
Alf,

Here is the code of includes, and procedures that I use in my gtk
application compiled on linux, xp,98 and 2000. Works well 24/7 for 2
years. code is ugly but working. Database is irrelevant, I have used it
with access, sqlserver, postgresql, and mysql sucessfully. This code
runs in production with a sqlserver database. I use dev-cpp in windows
and anjuta in linux.

I do have some code in another program that interrogates failed calls
and returns debugging info so you can fed it back through a dialog to
the user. I can dig it up and send it through next week.

You might find variable names to be suspiciously similar to various
tutorial examples around the net. Cut and paste programming I'm afraid.

I included the variable "button" in the procedure call so I could use a
gtk_timeout to periodically run the query.



Regards,
Kim

#ifdef HAVE_CONFIG_H
#  include  
#endif 
 
#include  
 
#include "callbacks.h" 
#include "interface.h" 
#include "support.h" 
#include "callbacks.h" 
#include "interface.h" 
#include "support.h" 
#include "stdio.h" 
#include "windows.h" 
#include "stdio.h" 
#include "sql.h" 
#include "SQLEXT.H" 
#include  
#include   
 
 
.
.
.
 
int odbccall1(GtkWidget *button) 
 
 
{ 
 
 
HENV henv = NULL; 
HDBC hdbc1 = NULL; 
HSTMT hstmt1 = NULL; 
UCHAR   szDSN[SQL_MAX_DSN_LENGTH] =
"mydsn";// Data
Source Name buffer 
UCHAR   szUID[10] = "MyUsername"; // User ID buffer 
UCHAR   szPasswd[10] = "MyPassword";  // Password
buffer 
UCHAR   szSqlStr[] = "SELECT truck, loader FROM RowQuery"; 
UCHAR   szTruck[8];   // Machine name buffer 
SDWORD  cbTruck; 
UCHAR   szLoader[20];// Model buffer bytes
recieved 
SDWORD  cbLoader; 
UCHAR   szMachNm[8];   // Machine name buffer 
SDWORD  cbMachNm; 
UCHAR   szActId[20];// Model buffer bytes
recieved 
SDWORD  cbActId; 
UCHAR   szModelDs[30];// Activity buffer 
SDWORD  cbModelDs; 
UCHAR   szOpNm[30];// CircuitNo 
SDWORD  cbOpNm; 
UCHAR   szActivity[50];  // Model buffer 
SDWORD  cbActivity; 
UCHAR   szGpsZone[50];  // Model buffer 
SDWORD  cbGpsZone; 
UCHAR   szBCM[10];  // Model buffer 
SDWORD  cbBCM; 
UCHAR   szSG[10];  // Model buffer 
SDWORD  cbSG; 
UCHAR   szShCycles[30];  // Model buffer 
SDWORD  cbShCycles; 
UCHAR   szassign_locn_1[10];  // Model buffer 
SDWORD  cbassign_locn_1; 
UCHAR   szassign_locn_2[10];  // Model buffer 
SDWORD  cbassign_locn_2; 
UCHAR   szis_to_loader[10];  // Model buffer 
SDWORD  cbis_to_loader; 
UCHAR   szhaulpath_perct[10];  // Model buffer 
SDWORD  cbhaulpath_perct; 
UCHAR   szis_on_circuit[10];  // Model buffer 
SDWORD  cbis_on_circuit; 
 
UCHAR   szloader_loading[10];  // Model buffer 
SDWORD  cbloader_loading; 
UCHAR   sztelem_status[10];  // Model buffer 
SDWORD  cbtelem_status; 
 
 
double  tmp=0; 
 
 
 
 
gchar message[100]; 
int i,k,j,trucks; 
RETCODE retcode; 
GtkWidget *w; 
w=lookup_widget(button,"label1"); 
 
 
if(strcmp(odbccallstatus,"active")==0) 
{ 
printf("odbc call alreamdy in progress"); 
return(1); 
} 
 
sprintf(odbccallstatus,"active"); 
 
retcode = SQLAllocHandle (SQL_HANDLE_ENV, NULL, &henv);   //
Allocate
the ODBC Environment and save handle. 
if((retcode != SQL_SUCCESS)&&( retcode !=
SQL_SUCCESS_WITH_INFO)) 
{ 
//  fprintf(debugLog,"odbc call failed 1 to allocate
handle"); 
sprintf(odbccallstatus,"inactive"); 
return(2); 
} 
 
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,(SQLPOINTER)
SQL_OV_ODBC3, SQL_IS_INTEGER);   // Let ODBC know this is an ODBC 3.0
application. 
if((retcode != SQL_SUCCESS)&&( retcode !=
SQL_SUCCESS_WITH_INFO)) 
{ 
//  fprintf(debugLog,"odbc call failed 2 to set version"); 
sprintf(odbccallstatus,"inactive"); 
return(3); 
} 
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1);   //
Allocate
an ODBC connection and connect. 
if((retcode != SQL_SUCCESS)&&( retcode !=
SQL_SUCCESS_WITH_INFO)) 
{ 
//  fprintf(debugLog,"odbc call failed 3 to allocate a
connection"); 
sprintf(odbccallstatus,"inactive"); 
   

Gtk treeview use with large data sources

2005-09-06 Thread Kim Adil
I have been searching for some time now to figure out how to approach
using gtk treeview ( with a list model) with a sql database. I am using
odbc on multiple platforms , hence gnomedb is not appropriate. Ideally
the scrollwindow will behave as per using the standard list model. My
questions:

(1) should I write a custom list model that I can connect an odbc dsn &
query to the treeview
(2) should I disect gnome-db to find out the professionals approach it
(3) should I give up and page the resultset into pages of 500 row that
can be scrolled easily without

Appreciate any sensible ideas

Thanks
Kim

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


garray beginner problem

2005-05-27 Thread Kim Adil
I am trying to figure out how to use GArray containers. This gives me 
rubbish in the printf output. I think it relates to how I am accessing 
the data nce it is in the array rather than what is stored in the array. 
Any comments and ideas would be appreciated.


 GArray *garray;


 garray = g_array_new (FALSE, FALSE, sizeof (Machine));
 for (i = 1; i < 1; i++){
 Machine *newMach = machine_new(i,"trd11","d11","joe");
 g_array_append_val (garray, newMach);

 }



for (i = 2; i < 5000; i++){
  
   Machine *u=&(g_array_index (garray, Machine, i));

 printf("%s\n",u->machine_name);
 }

 g_array_free (garray, TRUE);
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


gobjects, glists and arrays beginners question

2005-05-26 Thread Kim Adil
I have written a fairly comprehensive industrial display program, and 
would like to rewrite version 2 in a better way. In version 1 I used 
arrays of structs to manage various portions of the data, for example:


struct machine{
   gint machineNumber;
   gchar machineName[30];
   gchar model[30];
   gchar operator[30];
   gint activityNumber;
   gint activity[30];
   gint alarmLevel;

};
struct machine machineArray[100],ODBCmachineArray[100];

I would like to do a "better" job by using some type of dynamic memory 
management to make the application more flexible, ie able to handle a 
variable number of machines. My expertise is very limited in this area 
(sorry mechanical engineer trying to do software dev) and I would 
appreciate any advice on how to use gobject, glist, or any preferred 
approach for this sort of application.


Thanks,
Kim
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list