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

setting color of clist selection



hi-

i'm still loving gtk, but now - i got a vexing question.
check out the following:
(the question is after the func)
/**********************************************************************************/

void
Selected(GtkWidget *aCList, int row, int column, GdkEventButton *event,
gpointer data)
{

 static  int currentrow=-1;
 Fields            *aField;
 GtkWidget  *aTextBox;
 GdkColor     gColor;


 if (currentrow == row)
  ;//dawdle
 else {
  //don't need to deref row here - we get it passed to
  //us by the system - in the implementation of the CList
  //callback.
  if (!(gtk_clist_row_is_visible(GTK_CLIST(aCList), row) ==
GTK_VISIBILITY_FULL))
   gtk_clist_moveto(GTK_CLIST(aCList), row, column, 0.5, 0);
  aField = (Fields *)((DataStruct *)data)->ptr3;
  aTextBox = (GtkWidget *)((DataStruct *)data)->ptr5;

  FillTextBox(aTextBox, aField, aCList, row);
  gColor.red = 0;
  gColor.blue = 0;
  gColor.green = 0;
  gtk_clist_set_background(GTK_CLIST(aCList), row, &gColor);
  CURRENTROW = row;
  currentrow = row;
 }
}
/**********************************************************************************/

Selected() is the callback for the clist - triggered on the clist signal
"select_row"
FillTextBox() - clears a textbox and refills it with data associated
with the clist row
that was selected. and of course u know what gtk_clist_moveto() does.

the vexing question is why doesn't gtk_clist_set_background() work
correctly???
(let me rephrase that - how i want it to work).

what happens is:
1) when the program starts a bunch of clist rows are created and put in
the clist.

2) after showng the mainwindow - i do a gtk_clist_select_row() to force
a selection

3) the row is selected - because i can see that the textBox is updated.

4) BUT the row background does NOT change!

dig this: if i click the mouse over a different row - the previously
selected row
is now painted! -
ie:
if in step 2) i did  gtk_clist_select_row(aCList, 1, 0)
data for row 1 shows up in the textBox (the bkgrnd of the row doesnt
change)

then if i click (say) row 22 - data for row 22 shows up in the textBox
AND
the bkgrnd of ROW 1 is now changed!

what's going on?? thanks 4 any help.

the rude...





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