News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
Keep tabs from resizing
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: Keep tabs from resizing

Try this:

-- Tabber: A little scripty thing, to keep track of found tabs, search them, rate them, compress them, autoscroll, print them...
function tabber_exit()
  local confirm=fltk.fl_choice("sure you want to quit?","stay","quit",NULL)
    if confirm == 1 then os.exit(0) else tabber:show() end

tabber = fltk:Fl_Double_Window(510, 410)

menubar = fltk:Fl_Menu_Bar(0, 0, 510, 25)

--do tabsGroup = fltk:Fl_Group(10,25,490,350)
        tabs  = fltk:Fl_Tabs(5, 25, 500, 380)
            do editorTab = fltk:Fl_Group(10, 50, 490, 350, "Editor")
                textbuffer = fltk.Fl_Text_Buffer()
                textEditor = fltk:Fl_Text_Editor(10, 55, 485, 315)
                editButton = fltk:Fl_Light_Button(335, 375, 50, 25, "Edit")
                newButton = fltk:Fl_Button(390, 375, 50, 25, "New")
                saveButton = fltk:Fl_Button(445, 375, 50, 25, "Save")
One problem was the relative sizes of the tabs group (tabs, not tabsGroup)
and its contents. The tabs widget automatically scales its tabs according
to the amount of space between the position of the tabs group and the
position of the group inside it. which ever end has the wider space gets
the tabs, and their scale is determined by the amount of that space.
I changed the y position of tabs to 25, which gives them a 25px size
because the group inside has a y position of 50.

Also I commented out tabsGroup because it is redundant in this case.
Fl_Tabs is already a group itself, so unless you plan to have something
adjacent to tabs and also contained by tabsGroup, there's no need for it.

The resizable does still affect the tabs and everything else in a window.
You have to be explicit about the widget(s) you want to allow to resize,
starting with the top level window and working down through each group:


I had to globalize some of those widgets in order for this to work.
If you're working on a small application that doesn't need to call
or be called from another script, there is little harm in using
global objects for most things. In many cases it is necessary, in
order for the various objects to communicate with each other.

The second and third tabs contain a slug which gets the resize, to
show how setting a particular widget in a particular way can affect
the resize and prevent other objects in that group from resizing.
Resizable is a big pain, though. I still have difficulty determining
how to organize widgets sometimes in order to get the correct behavior.

            do searchTab = fltk:Fl_Group(10, 50, 490, 350, "Search")
slug1=fltk:Fl_Box(10,200,10,100); slug1:box(fltk.FL_BORDER_BOX); slug1:align(fltk.FL_ALIGN_WRAP) -- DEBUGGING
slug1:label("note the initial scale and position of this box. It is between the non-scaling objects")
                 pattern = fltk:Fl_Input(90, 65, 400, 25, "Search for")
                 fieldChoice = fltk:Fl_Choice(90, 90, 400, 25, "for")
                        local choices = {"Artist","Title","Chord"}
                        for i = 1,table.getn(choices) do
                 searchButton = fltk:Fl_Return_Button(415, 375, 85, 25, "Search!")
                 clearButton = fltk:Fl_Button(355, 375, 55, 25, "Clear")
                 helpButton = fltk:Fl_Button(295, 375, 55, 25, "Help")
                 exact = fltk:Fl_Check_Button(90, 115, 400, 25, "exact")
            do browseTab = fltk:Fl_Group(10, 50, 490, 350, "Browse")
slug2=fltk:Fl_Box(10,350,490,1); slug2:box(fltk.FL_BORDER_BOX) -- DEBUGGING
            fltk.Fl_End()   -- end of tabs
  --      fltk.Fl_End()       -- end of TabsGroup

04-01-2008 05:25 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Keep tabs from resizing - jpjacobs - 03-31-2008, 04:16 AM
RE: Keep tabs from resizing - mikshaw - 03-31-2008, 12:26 PM
RE: Keep tabs from resizing - mikshaw - 04-01-2008 05:25 AM
RE: Keep tabs from resizing - jpjacobs - 04-01-2008, 08:53 PM
RE: Keep tabs from resizing - mikshaw - 04-01-2008, 11:54 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: