Re: GtkNotebook with action on click of special tab



On 27/04/11 10:02, Bernhard Schuster wrote:
2011/4/27 Bill Czermak<czermak netspace net au>:
Hi Bernhard

Checked my code and last updated my notebook handling source last November.
  Probably written 6 months earlier, and changes were to restructure the way
I was using GTK, rather than change the notebook handling area.  So I might
have forgotten a few implementation problems I solved at the time

I only use the switch-page signal and it displays fine for me  (GTK2 on
Ubuntu 10.10).  Dont use any other signals to handle notebook pages.

Set current page works as expected for me.  I recall I had a problem in that
if no data was displayed on the page, then the new page was not displayed...
  not what I expected, but fixed by setting up some data on the page.
I had this issue too, but that was easy to fix.
Some pesudocode to clearify:

callback on "page-switched":
{
create tab label
create tab child
show label
show child
spawn new tab
set the recently spawn tab to be the new current tab
}

The crux lies in the fact (I think) that this callback gets executed
on "page-switch" which itself changes the current tab

What I need this for? Imageine a plus on the last tab, as soon as you
click that tab head, a new tab with some other content spawns. (Just
in case someone cares)

Regards

Bernhard

Hi Bernhard

Sorry did not check my email for a while, so I reply after several hours.

The "page-switch" callback indicates that a new page is visible to the user. Nothing more and can be result of program code or user action.

Guess it all depends on the user interface design for your application, and I am not sure what you are trying to do.

In my case, I was coding an ERP system, replacing a legacy system. So I might open a list of parts in one tab, a component list in another tab, and details of individual components on subsequent tabs.

The (simplified) program logic goes like this...

Inital notebook tab allows a part to be selected by clicking to select from a list of parts. Next tab shows a component list... setup by program and displayed when part is clicked.
The user can click and switch notebook pages all within gtkmain()
If the user clicks a component on the component list, then detailed part data is shown on a new tab, and this tab is displayed..(occasionally the tab would be setup and not displayed.. possibly a bug somewhere, but the user could click the tab to display it, I dont remember if I have investigated this fully). User can close these part detail tabs or keep several of them open (click an "x" in tab header to close tab)
User can select parts and add them as components.

So the application always knows what to display in the various tabs. If the user opens 20 tags displaying component details and is confused then unwanted tags can be closed by the user. It all depends on the BOM.. Simple is best.

Obviously I handle callbacks for normal data handling from the fields displayed in the various tag pages, but I dont need to handle anything except the "page-switch" callback so far a notebook pages are concerned. Notebook function works nicely for me.

Hope this helps.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]