FLTK logo

Re: [fltk.general] Fl_Hold_Browser

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Hold_Browser "holm.h... Sep 10, 2020  
 
Here is a small program, where my problem is exposed. I use the Set_Font routine to recusively set font in my program.
Do anyone see the problem in my code ? The browser do not show all entries.

#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Counter.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_XPM_Image.H>
#include <FL/Fl_XBM_Image.H>
#include <FL/Fl_Tiled_Image.H>
#include <FL/fl_draw.H>

Fl_Double_Window *Win;
Fl_Hold_Browser *B;

void Set_Font_Size(Fl_Widget* pWdg, int Labelsize, int Textsize, int lev){
  int i;
 
  pWdg->labelsize(Labelsize);
  if (Fl_Browser_*          pB= dynamic_cast< Fl_Browser_* >(pWdg))        pB->textsize(Textsize);
 
  if (Fl_Group* pG= dynamic_cast< Fl_Group* >(pWdg)){
    for (int i= 0; i< pG->children(); ++i)    Set_Font_Size(pG->child(i), Labelsize, Textsize, 1);
  }
 
  return;
}

int main() {
  char s[256];
  int i;
 
  Win = new Fl_Double_Window(200,400);
  { Fl_Hold_Browser* o = B = new Fl_Hold_Browser(0, 0, 200, 400);
    for (i=0;i<1000;i++){
      sprintf(s, "number %d\n", i);
      o->add(s);
    }
    o->end();
  }
  Win->show();
  Set_Font_Size(Win, 20, 20, 1);
  return Fl::run();
}


torsdag 10. september 2020 kl. 14:38:34 UTC+2 skrev Greg Ercolano:
On 2020-09-10 04:18, holm.h...@gmail.com wrote:
> Thanks, you pointed me to the right way: it seems to be related to font/sizing. I still have not made a working small example where the problem is exposed, but will try to make one.
>

I couldn't replicate, but I did make this which seems to work OK.

#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Hold_Browser.H>
int main(int argc, char *argv[]) {
Fl_Double_Window *win = new Fl_Double_Window(250, 350, "Simple Browser");
win->begin();
{
// Create Hold Browser
Fl_Hold_Browser *hold = new Fl_Hold_Browser(10, 10, 200, 300, "Hold");
char s[256];
for (int i=0; i<100; i++) {
sprintf(s, "number %d\n", i);
hold->add(s);
}
hold->end();
}
win->end();
win->resizable(win);
win->show(argc, argv);
return(Fl::run());
}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/c4f4d49c-ecf5-44b4-b29c-91ab1455b416n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.