php-gtk3 icon indicating copy to clipboard operation
php-gtk3 copied to clipboard

GtkNotebook signals

Open d47081 opened this issue 1 year ago • 7 comments

Could somebody check following signals:

  • select-page
  • focus-tab

Because I can interact with switch-page only, other not tested yet

https://docs.gtk.org/gtk3/class.Notebook.html

d47081 avatar Apr 13 '24 06:04 d47081

what is the problem with this signals? can you provide a minimal working code of problem?

scorninpc avatar Apr 14 '24 02:04 scorninpc

Just this construction not reacts (ignores events) when I replacing it with signals above. So using current one.

Thought maybe PHP-GTK issue, if not - please close this issue.

d47081 avatar Apr 14 '24 04:04 d47081

You linked to set_scrollable

image

this works fine

image

What this is related to signals? do you want to trigger one signal?

scorninpc avatar Apr 15 '24 01:04 scorninpc

Sorry, I have updated repository yesterday, the line have been switched to 122

Just meant this construction there

$this->tabs->connect(
    'switch-page', // select-page, focus-tab - no reaction
    function ($tabs, $child, $position)
    ...

d47081 avatar Apr 15 '24 06:04 d47081

This works fine

image

<?php

	Gtk::init();

	$window = new GtkWindow();
	$window->set_size_request(500, 500);
	$window->set_title("PHP-GTK");

	// create the notebook
	$notebook = new GtkNotebook();
	$window->add($notebook);
	
	$notebook->set_scrollable(true);


	// add page 
	$notebook->append_page(GtkButton::new_with_label("Container 1"), new GtkLabel("Page 1"));
	$notebook->append_page(GtkButton::new_with_label("Container 2"), new GtkLabel("Page 2"));
	$notebook->append_page(GtkButton::new_with_label("Container 3"), new GtkLabel("Page 3"));

	$notebook->connect("switch-page", function($notebook,  $page, $num){
		var_dump("Page " . $num);
	});
	
	// connect to signal that close program
	$window->connect("destroy", function() {
		Gtk::main_quit();
	});

	// show all and start
	$window->show_all();
	Gtk::main();

scorninpc avatar Apr 16 '24 00:04 scorninpc

switch-page works, select-page, focus-tab nope

d47081 avatar Apr 16 '24 07:04 d47081

select-page https://stackoverflow.com/a/18352428/1935882

There is no descriptions available like select-page on doc

switch-page might handle all the cases, but if you really want use focus, you can use focus-in-event

scorninpc avatar Apr 16 '24 10:04 scorninpc