//How to set the positon of window1 to center ?// window1->set_position(GTK2_WINDOW(window), GTK2_WIN_POS_CENTER_ALWAYS);
//window1 is a toplevelWindow// object window1 = GTK2.Window(GTK2.WINDOW_TOPLEVEL);
Let us assume not to be programmer. Instead a metalworker. I only want to cut out a metal sheet as main in the right size and center position! The main frame of the project.
-- Sent from: http://pike.1058338.n5.nabble.com/Pike-Dev-f4605220.html
Hi Hans,
Are you saying that GTK2_WIN_POS_CENTER_ALWAYS isn't working the way you expect? I found this note in the GTK documentation:
Note that using Gtk::WIN_POS_CENTER_ALWAYS is almost always a bad idea. It won’t necessarily work well with all window managers or on all windowing systems.
Do any of the other positioning hints (such as GTK2_WIN_POS_CENTER or GTK2_WIN_POS_MOUSE work as expected? If they do, then I'd guess that the problem is related to GTK and its interaction with the windowing system.
Bill
January 25, 2018 5:54 AM, "Hans Schueren" werbung@hans-schueren.de wrote:
//How to set the positon of window1 to center ?// window1->set_position(GTK2_WINDOW(window), GTK2_WIN_POS_CENTER_ALWAYS);
//window1 is a toplevelWindow// object window1 = GTK2.Window(GTK2.WINDOW_TOPLEVEL);
Let us assume not to be programmer. Instead a metalworker. I only want to cut out a metal sheet as main in the right size and center position! The main frame of the project.
-- Sent from: http://pike.1058338.n5.nabble.com/Pike-Dev-f4605220.html
Hello William ,
thanks for your reply.
First i have prepared a pike editor and right syntax highlightning.
Then i probed the coding and came to this result that works !
_______________________________________________________
int main() { GTK2.setup_gtk();
object window1 = GTK2.Window(GTK2.WINDOW_TOPLEVEL); // Create a window
// Set a title on the window window1->set_title("Main Window!"); window1->set_size_request(600, 500); window1->set_position(GTK2.WIN_POS_CENTER);
// All set up, now show the window to the user window1->show_all(); window1->signal_connect("delete_event",lambda() {exit(0);}); return -1; }
_________________________________________________________________________
I think the | object | class is the TOPLEVEL class of gtk2. All other widgets are following. The Window now always appears in center ! A proper | delete_event | command is enclosed because if you do not - the program is not really closed. Its the same as the | END | command in basic , every script needs.
Thank you for your answer. I am one step closer and have learned something.
WBR Hans Schueren
-- Sent from: http://pike.1058338.n5.nabble.com/Pike-Dev-f4605220.html
pike-devel@lists.lysator.liu.se