Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gergely Polonkai
On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote:

 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 things that I *thought* might work by using

 s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));

 fails.  (with contains the String label1)  I have a index,
 n that can range from 1 to 99--whatever GtkWidget *label I
 need.  the next thing that occured was some kind of

 typedef struct
 {

 GtkWidget  *label1,
*label2,
*label3,
...
*label999;
 } Labels;

 can abybody clue on how to use my n index counter to stick
 one of the labels so they show up on my arrow window?

 thanks much.

 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
Unix
  Twenty-eight years of service to the Unix community.


This definitely calls for an array:

GtkWidget *label[1000];

as you cannot reference to a variable with a constructed name (like $$a in
PHP). If your struct holds only pointers, though, you can also cast it to
an array:

((GtkWidget **)label_list)[99]

but I haven't tested it, and highly discourage it.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gary Kline
=
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.

On Fri, Sep 05, 2014 at 09:43:00PM -0400, Chris Moller wrote:
 What do you mean, fails?  What happens?  And what do you want to happen?


when I try to output the const char *s by casting the buf,
with is a string, label1, it is NULL!  Yes, no kidding.
the next msg explains why.  

s = gtk_label_get_text(GTK_LABEL(labell);



iv'e looked at the following code:

label1 = gtk_label_new(1: This is the file name named talk.1.txt);

in another directory I have text files in /tmp/files/*;  I think
the files over there grab the 10 files;  *if* I stick the
output within gtk_label_new().  I think it may be a matter of
putting these files together and grabbing the content of the
talk.N.txt and putting them into gtk_label_new().

{ I am not explaining anything to this list, but at least I know
what I want to try }
.  




 
 On 09/05/14 21:12, Gary Kline wrote:
 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.
 
  things that I *thought* might work by using
 
 s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));
 
  fails.  (with contains the String label1)  I have a index,
  n that can range from 1 to 99--whatever GtkWidget *label I
  need.  the next thing that occured was some kind of
 
  typedef struct
  {
 
  GtkWidget  *label1,
 *label2,
 *label3,
 ...
 *label999;
  } Labels;
 
  can abybody clue on how to use my n index counter to stick
  one of the labels so they show up on my arrow window?
 
  thanks much.
 
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
 Twenty-eight years of service to the Unix community.


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


Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gergely Polonkai
What I would do instead is:

GtkWidget **label[1000]; // if you have a dynamic number of labels,
consider using a GArray maybe
int i = 0;

label[i++] = gtk_label_new(first text); // this will be label[0]
label[i++] = gtk_label_new(second text); // this will be label[1]
…

After this, instead of creating a string label1, you just need the
number 1, and can use this:

s = gtk_label_get_text(GTK_LABEL(label[1]));

where 1 can instead be a variable of int that holds 1:

int num = 1;
s = gtk_label_get_text(GTK_LABEL(label[num]));

On 6 September 2014 09:32, Gary Kline kl...@thought.org wrote:
 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 On Sat, Sep 06, 2014 at 08:08:34AM +0200, Gergely Polonkai wrote:
 On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote:
 
  =
  Organization: Thought Unlimited.  Public service Unix since 1986.
  Of_Interest: With 28 years  of service  to the  Unix  community.
 
  things that I *thought* might work by using
 
  s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));
 
  fails.  (with contains the String label1)  I have a index,
  n that can range from 1 to 99--whatever GtkWidget *label I
  need.  the next thing that occured was some kind of
 
  typedef struct
  {
 
  GtkWidget  *label1,
 *label2,
 *label3,
 ...
 *label999;
  } Labels;
 
  can abybody clue on how to use my n index counter to stick
  one of the labels so they show up on my arrow window?
 
  thanks much.
 
  --
   Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
 Unix
   Twenty-eight years of service to the Unix community.
 

 This definitely calls for an array:

 GtkWidget *label[1000];

 as you cannot reference to a variable with a constructed name (like $$a in
 PHP). If your struct holds only pointers, though, you can also cast it to
 an array:

 ((GtkWidget **)label_list)[99]

 but I haven't tested it, and highly discourage it.



 I will heed your advise!  a workaround may be in three *.c
 files.  but first:: sleep.

 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
  Twenty-eight years of service to the Unix community.


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

Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gary Kline
=
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.



well,  I hate to telll fibs, but I'm still at  it.  It has 
been years since  I listened to my bio;  'snot that bad..


On Sat, Sep 06, 2014 at 09:40:50AM +0200, Gergely Polonkai wrote:
 What I would do instead is:
 
 GtkWidget **label[1000]; // if you have a dynamic number of labels,
 consider using a GArray maybe
 int i = 0;
 
 label[i++] = gtk_label_new(first text); // this will be label[0]
 label[i++] = gtk_label_new(second text); // this will be label[1]


pretty sure I tried something like this about a week ago.
maybe last monday.  it may have segv'd.  but YES in cp_text.c
is ::


if (p)
{
   fprintf (stdout, %s, p);
   L[i++] = p;
}

here p is  the string or stringgs *within* /tmp/file/text.N.txt;
I planned on passing L[] to what you have above: first text,
second text.  

in my example text.1.txt files I have (e.g.) i am bringing this
laptop to the group so I can be more easily understood.

 …
 
 After this, instead of creating a string label1, you just need the
 number 1, and can use this:
 
 s = gtk_label_get_text(GTK_LABEL(label[1]));
 
 where 1 can instead be a variable of int that holds 1:
 
 int num = 1;
 s = gtk_label_get_text(GTK_LABEL(label[num]));


many thanks indeed.  I'm' going to save your mail and get a 
hardcopy.  tthen join the directories, c. 


 On 6 September 2014 09:32, Gary Kline kl...@thought.org wrote:
  =
  Organization: Thought Unlimited.  Public service Unix since 1986.
  Of_Interest: With 28 years  of service  to the  Unix  community.
 
  On Sat, Sep 06, 2014 at 08:08:34AM +0200, Gergely Polonkai wrote:
  On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote:
  
   =
   Organization: Thought Unlimited.  Public service Unix since 1986.
   Of_Interest: With 28 years  of service  to the  Unix  community.
  
   things that I *thought* might work by using
  
   s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));
  
   fails.  (with contains the String label1)  I have a index,
   n that can range from 1 to 99--whatever GtkWidget *label I
   need.  the next thing that occured was some kind of
  
   typedef struct
   {
  
   GtkWidget  *label1,
  *label2,
  *label3,
  ...
  *label999;
   } Labels;
  
   can abybody clue on how to use my n index counter to stick
   one of the labels so they show up on my arrow window?
  
   thanks much.
  
   --
Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
  Unix
Twenty-eight years of service to the Unix community.
  
 
  This definitely calls for an array:
 
  GtkWidget *label[1000];
 
  as you cannot reference to a variable with a constructed name (like $$a in
  PHP). If your struct holds only pointers, though, you can also cast it to
  an array:
 
  ((GtkWidget **)label_list)[99]
 
  but I haven't tested it, and highly discourage it.
 
 
 
  I will heed your advise!  a workaround may be in three *.c
  files.  but first:: sleep.
 
  --
   Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
   Twenty-eight years of service to the Unix community.
 
 

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
 Twenty-eight years of service to the Unix community.


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

more of a C question than GTK+3.0??

2014-09-05 Thread Gary Kline
=
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.

things that I *thought* might work by using 

s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));

fails.  (with contains the String label1)  I have a index, 
n that can range from 1 to 99--whatever GtkWidget *label I
need.  the next thing that occured was some kind of

typedef struct 
{

GtkWidget  *label1,
   *label2,
   *label3,
   ...
   *label999;
} Labels;

can abybody clue on how to use my n index counter to stick
one of the labels so they show up on my arrow window?

thanks much.

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
 Twenty-eight years of service to the Unix community.


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


Re: more of a C question than GTK+3.0??

2014-09-05 Thread Chris Moller

What do you mean, fails?  What happens?  And what do you want to happen?


On 09/05/14 21:12, Gary Kline wrote:

=
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.

things that I *thought* might work by using

s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));

fails.  (with contains the String label1)  I have a index,
n that can range from 1 to 99--whatever GtkWidget *label I
need.  the next thing that occured was some kind of

typedef struct
{

GtkWidget  *label1,
   *label2,
   *label3,
   ...
   *label999;
} Labels;

can abybody clue on how to use my n index counter to stick
one of the labels so they show up on my arrow window?

thanks much.



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