Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:32:12+00:00 2026-05-26T08:32:12+00:00

I am writing application in C# using GTK# GUI framework to make it cross-platform.

  • 0

I am writing application in C# using GTK# GUI framework to make it cross-platform.
Many things are being done in GTK# not like in WPF/Windows.Forms, but most of them I was able to solve on my own.

There is a “little” problem, what became not that “little” when I tried to solve it.
I am saving window position and maximized flag to config file when application is being closed.
But when I am trying to restore window parameters, they are being restored not correctly.

Methods I tried to use:

SetSizeRequest():

this.SetSizeRequest((int)config["windowwidth"], (int)config["windowheight"]);

SetDefaultSize():

this.SetDefaultSize((int)config["windowwidth"], (int)config["windowheight"]);

Resize():

this.Resize((int)config["windowwidth"], (int)config["windowheight"]);

The problem is:
Some of these methods does not work at all (change nothing). Others behave strangely: set window size to not the one was loaded from config, make window continuously expanding, etc.

I am also adding a constraint on size of one specific widget:

Gdk.Geometry geom = new Gdk.Geometry();
geom.MinWidth = 800;
geom.MinHeight = 400;
this.SetGeometryHints(BoxNotebook, geom, Gdk.WindowHints.MinSize);

When I use all this together, it is becoming a complete mess.
What is the correct way to restore window size at program startup ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:32:13+00:00Added an answer on May 26, 2026 at 8:32 am

    Resize works in my application. Are you sure that the correct values are being loaded from the config file?

    EDIT

    Here is a Glade file that seems to do what you want:

    <?xml version="1.0"?>
    <interface>
      <object class="GtkWindow" id="window">
        <child>
          <object class="GtkHPaned" id="hpaned">
            <child>
              <object class="GtkNotebook" id="notebook">
                <property name="width_request">300</property>
                <child>
                  <object class="GtkScrolledWindow" id="scrolledwindow">
                    <child>
                      <object class="GtkTreeView" id="treeview"/>
                    </child>
                  </object>
                </child>
                <child type="tab">
                  <object class="GtkLabel" id="label1">
                    <property name="label">300 px wide</property>
                  </object>
                  <packing>
                    <property name="tab_fill">False</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="resize">True</property>
                <property name="shrink">False</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label2">
                <property name="width_request">400</property>
                <property name="label">400 px wide</property>
              </object>
              <packing>
                <property name="resize">False</property>
                <property name="shrink">False</property>
              </packing>
            </child>
          </object>
        </child>
      </object>
    </interface>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a XUL application using JavaScript for the coding. I would like to
I am writing a new application using the Entity Framework. Where would the EF
I am writing an application using C# and I would like to read some
I'm writing an windforms application using .NET (actually IronPython, but that's not relevant), and
I am writing an application using openFrameworks, but my question is not specific to
I would like to build a GUI for an OCaml application I'm writing. My
I'm writing an application using Ruby and the Eventmachine library. I really like the
I'm writing an application using WPF, and I need to make something that looks
I am writing a simple application and am using glade (gtk) for the UI.
I am writing an application in MVC2 using Entity Framework As I know ViewModel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.