Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GtkNotebook signals #95

Open
d47081 opened this issue Apr 13, 2024 · 7 comments
Open

GtkNotebook signals #95

d47081 opened this issue Apr 13, 2024 · 7 comments

Comments

@d47081
Copy link
Contributor

d47081 commented Apr 13, 2024

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

@scorninpc
Copy link
Owner

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

@d47081
Copy link
Contributor Author

d47081 commented Apr 14, 2024

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.

@scorninpc
Copy link
Owner

You linked to set_scrollable

image

this works fine

image

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

@d47081
Copy link
Contributor Author

d47081 commented Apr 15, 2024

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)
    ...

@scorninpc
Copy link
Owner

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();

@d47081
Copy link
Contributor Author

d47081 commented Apr 16, 2024

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

@scorninpc
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants