[fltk.bugs] button inside loop

2013-02-01 Thread superbem
this code

for(int i=0;i5;i++){
char u[10];
sprintf(u,%d,i);
new Fl_Button(25*i+20, 50, 25, 25,u);
}

shows all buttons with the same label and it should be incremental.
All of them with the last i, 4.
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] button inside loop

2013-02-01 Thread Duncan Gibson
 this code

 for(int i=0;i5;i++){
 char u[10];
 sprintf(u,%d,i);
 new Fl_Button(25*i+20, 50, 25, 25,u);
 }

 shows all buttons with the same label and it should be incremental.
 All of them with the last i, 4.


Because the buffer u goes out of scope at the end of the block,
and the memory is being re-used next time through the loop,
overwriting what the previous buttons were looking at.

You need to save the pointer to the button, temporarily at least,
and then use copy_label() so that the contents of u are copied
into the button itself.


Also, fltk.bugs is now intended for feedback and reporting from
the FLTK Software Trouble Report (STR) system. Few humans read
fltk.bugs directly. Please post user problems to fltk.general.

D.
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.general] EDE/FLTK talks on FOSDEM

2013-02-01 Thread Duncan Gibson
 I got a wonderful chance to talk about EDE and FLTK on FOSDEM[1]

Although I live relatively close by in the Netherlands, I won't be
able to make it.

Do FOSDEM have plans to post links to the any of the presentations?
If not, will you be posting them somewhere?

Good luck with the presentations.
D

This message and any attachments are intended for the use of the addressee or 
addressees only. The unauthorised disclosure, use, dissemination or copying 
(either in whole or in part) of its content is not permitted. If you received 
this message in error, please notify the sender and delete it from your system. 
Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] Changing an Fl_Menu_Bar item colors

2013-02-01 Thread MacArthur, Ian (Selex ES, UK)
Here's a test - is this any better?

 If you send a message that uses characters from certain character sets
 in the message body. Messages that use character sets from the
 following code pages are encoded as Base64 messages when they are sent
 from an Exchange 2000 computer:
 
 Shift-JIS
 EUC-KR
 ISO-2202-JP
 BIG5
 ISO-2202-KR
 GB18030
 GB2312


Yup - though I don't use any CJK language normally, so I don't think that can 
be it.

I do wonder if it is struggling with something else that is getting encoded as 
UTF-8 in my posts though? That might do it I guess, if it is 7-bit cleanness 
that is the issue here?



This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.


___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


[fltk.general] Moving symbol on Fl_Menu_Bar Fl_Menu_Item

2013-02-01 Thread Howard Rubin
I'm adding a symbol to an Fl_Menu_Item on an Fl_Menu_Bar using 
set_labeltype(). It's mostly working but when the menu is dropped down, 
the symbol moves to the left by about 12 units. (BTW, this approach 
solves the Changing an Fl_Menu_Bar item colors question)

Why does the symbol move and how can I keep it from moving?

#include FL/Fl.H
#include FL/fl_draw.H
#include FL/Fl_Double_Window.H
#include FL/Fl_Menu_Bar.H
// In fl_labeltype.cxx
extern void fl_normal_label(const Fl_Label* o, int X, int Y, int W, int 
H, Fl_Align align);
extern void fl_normal_measure(const Fl_Label* o, int W, int H);

enum { EXTRA_MENU_WIDTH = 10, };

void menu_label(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align a) {
 fl_normal_label(o, X, Y, W, H, a);
 // * Why does this move when the menu item is selected? *
 fl_circle(X+W-12, Y+H/2, 5);
}
void menu_measure(const Fl_Label* o, int W, int H) {
 fl_normal_measure(o, W, H);
 W += EXTRA_MENU_WIDTH;
}

int main(int argc, char **argv) {
 Fl_Double_Window *win = new Fl_Double_Window(300,25);
 Fl_Menu_Bar* menubar  = new Fl_Menu_Bar(0,0,300,25);

 menubar-add(Menu1/one, 0, 0, 0, 0);
 menubar-add(Menu1/two, 0, 0, 0, 0);

Fl::set_labeltype(static_castFl_Labeltype(FL_FREE_LABELTYPE),
   menu_label, menu_measure);

 const Fl_Menu_Item* m ;
 if ((m = menubar-find_item(Menu1)) != NULL) {
 const_castFl_Menu_Item*(m)-labeltype_ = FL_FREE_LABELTYPE;
 }

 win-end();
 win-show();

 return Fl::run();
}

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] Moving symbol on Fl_Menu_Bar Fl_Menu_Item

2013-02-01 Thread Ian MacArthur

On 1 Feb 2013, at 21:54, Howard Rubin wrote:

 I'm adding a symbol to an Fl_Menu_Item on an Fl_Menu_Bar using 
 set_labeltype(). It's mostly working but when the menu is dropped down, 
 the symbol moves to the left by about 12 units. (BTW, this approach 
 solves the Changing an Fl_Menu_Bar item colors question)
 
 Why does the symbol move and how can I keep it from moving?

I'm not entirely sure *why* it is happening, but it is pretty easy to see 
*what* is happening...

If you modify menu_label as follows...

void menu_label(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align a) {
fl_normal_label(o, X, Y, W, H, a);
// * Why does this move when the menu item is selected? *

// W = 63; // apply the sledgehammer fix...
int xx = X + W - 12;
int yy = Y + (H / 2);

printf(pos (%d, %d) (X %d Y %d W %d H %d)\n, xx, yy, X, Y, W, H);

fl_circle(xx, yy, 5);
}

Then at run time (on this Mac, numbers on other hosts might conceivably differ?)

For the not selected menu:

pos (60, 12) (X 9 Y 0 W 63 H 25)

For the selected menu:

pos (45, 9) (X 6 Y 0 W 51 H 19)


Now... I am not sure what I'm seeing there, but I speculate that the changes to 
X and H reflect the change in the size of the selection rectangle or something, 
they seem to be about 3 (or 6) pixels off the size of the no-selection case? 3 
pixels seems about right for the inset of the selection from the edges...

The kicker is the change in the W value - and I don't know what is happening 
there at all...

However, that is the key - note the commented out sledgehammer fix in the 
code fragment. With that enabled it all works just fine.

So; not a solution, but might be a hint where to look (or how to hack around 
it!)



___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk