GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Mar-2005, 12:06
maveganzones's Avatar
maveganzones maveganzones is offline
New Member
 
Join Date: Mar 2005
Location: San Sebastian (Spain)
Posts: 12
maveganzones is on a distinguished road

problems with a text display in a tab


Hi all, im newbie programming with fltk and i have a little problem with the Fl_Text_Display.

I have a Fl_Tabs window with some tabs, no problem.

In one of the tabs i have a Fl_Text_Display that its ok but a little problem. It dosnt draw in the tab, the text display draws itself in the main window. This is the code:
CPP / C++ / C Code:
// the main window
Fl_Window *window = new Fl_Window( 1024,768 );

// the tab window
Fl_Tabs *tabs = new Fl_Tabs(40, 300, 944, 440);
tabs -> box(FL_BORDER_BOX);

// tab one
Fl_Group *tab1 = new Fl_Group(40,330,944,410,"Tab 1");
tab1 -> selection_color(FL_BACKGROUND2_COLOR);
// the text display
Fl_Text_Display *display = new Fl_Text_Display(0,0,900,400);
Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
display -> buffer(buffer);
buffer -> text("Hola");
tab1 -> resizable(display);
tab1 -> end();
Fl_Group::current() -> resizable(tab1);

// tab two
Fl_Group *tab2 = new Fl_Group(40,330,944,410,"Tab 2");
tab2 -> selection_color(FL_BACKGROUND2_COLOR);
tab2 -> end();
Fl_Group::current() -> resizable(tab2);

// tab three
Fl_Group *tab3 = new Fl_Group(40,330,944,410,"Tab 3");
tab3 -> selection_color(FL_BACKGROUND2_COLOR);
tab3 -> end();
Fl_Group::current() -> resizable(tab3);

// ending the tabs
tabs -> add(tab1);
tabs -> add(tab2);
tabs -> add(tab3);
tabs -> value(tab1);
tabs -> end();
tabs -> show();

// ending the main window
window -> end();
window -> show(argc, argv);
return Fl::run();

Thanks
Last edited by LuciWiz : 22-Mar-2005 at 13:28. Reason: Please insert your C code between [c] & [/c] tags
  #2  
Old 22-Mar-2005, 15:09
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by maveganzones
Hi all, im newbie programming with fltk and i have a little problem with the Fl_Text_Display.

I have a Fl_Tabs window with some tabs, no problem.
Welcome to GIDForums™. As you see LuciWiz (thanks Lucian) added the code tags to your post. Nice and easy, just surround your post.
Code:
CPP / C++ / C Code:
// Your code here

That helps the formatting and highlights the code. `Nuff said.

Quote:
Originally Posted by maveganzones
In one of the tabs i have a Fl_Text_Display that its ok but a little problem. It dosnt draw in the tab, the text display draws itself in the main window. This is the code:
CPP / C++ / C Code:
// the main window
Fl_Window *window = new Fl_Window( 1024,768 );
// code removed, posted above

Thanks

I compiled your code and it just seems that you are not referring to the screen coords but trying to place relative to a group. You can find some code for this in this thread. I took the liberty to shrink the example down a bit so I could see what I was doing.

CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Text_Display.H>

int main(int argc, char **argv){

  // the main window
  Fl_Window *window = new Fl_Window( 800,600 );

  // the tab window
  Fl_Tabs *tabs = new Fl_Tabs(20, 40, 750, 550);
  tabs -> box(FL_BORDER_BOX);

  // tab one
  Fl_Group *tab1 = new Fl_Group(20,60,700,500,"Tab 1");
  tab1 -> selection_color(FL_BACKGROUND2_COLOR);
  // the text display
  Fl_Text_Display *display = new Fl_Text_Display(25,65,400,400);
  Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
  display -> buffer(buffer);
  buffer -> text("Hola");
  tab1 -> resizable(display);
  tab1 -> end();
  Fl_Group::current() -> resizable(tab1);
  
  // tab two
  Fl_Group *tab2 = new Fl_Group(20,60,700,500,"Tab 2");
  Fl_Text_Display *display2 = new Fl_Text_Display(100,100,200,200);
  display2->buffer(buffer);
  tab2 -> selection_color(FL_BLUE);
  tab2 -> end();
  Fl_Group::current() -> resizable(tab2);
  
  // tab three
  Fl_Group *tab3 = new Fl_Group(20,60,700,500,"Tab 3");
  Fl_Text_Display *display3 = new Fl_Text_Display(200,200,100,100);
  Fl_Text_Buffer *buffer2 = new Fl_Text_Buffer();
  buffer2->text("Hello");
  display3->buffer(buffer2);
  tab3 -> selection_color(FL_RED);
  tab3 -> end();
  Fl_Group::current() -> resizable(tab3);
  
  // ending the tabs
  tabs -> add(tab1);
  tabs -> add(tab2);
  tabs -> add(tab3);
  tabs -> value(tab1);
  tabs -> end();
  tabs -> show();
  
  // ending the main window
  window -> end();
  window -> show(argc, argv);
  return Fl::run();
}

You could have done a redraw on the window when you changed tabs and the overlap would have been repainted. Just a positioning problem.

Hope this is the info you were fishing for.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
Last edited by cable_guy_67 : 22-Mar-2005 at 16:35.
  #3  
Old 23-Mar-2005, 02:26
maveganzones's Avatar
maveganzones maveganzones is offline
New Member
 
Join Date: Mar 2005
Location: San Sebastian (Spain)
Posts: 12
maveganzones is on a distinguished road
Thanks, i didnt know the c++ tag to put the code, its great.
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 2) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
burning problems PLEASE PLEASE HELP kelticeire Computer Hardware Forum 4 01-Dec-2006 15:39
Problems in Counting Lines in Text File wc3promet C++ Forum 2 22-Oct-2004 19:12
Problems with changing display resolution vsseym Computer Software Forum - Windows 2 27-Jul-2004 10:01
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.