Is there any way to find the Screen Resolution through TCL/TK

Posted on 2004-11-29
Last Modified: 2008-03-10
I have developed a tool using TCL/TK
If I operate it with the resolution 1024x768 I can get the full view of the tool
If I port it to some other m/c which has resolution less than that
ie 800x600 or 640x480
I could not get the full view of the tool
If I resize it, the buttons and other widgets are going inside so that I cannot able to operate those
Is there any way to get the screen resolution and resize it accordingly
or else any other way to solve this issue

Thanx in advance
Question by:Rajmahesh
    LVL 6

    Accepted Solution

    The best way to solve this problem, is redesign your user interface and develop it for 800x600 or even 640x480
    This way your application will be viewable in higher resolutions with no problem and the lower resolutions still look as you intended to.

    Optionally you can detect the screen resolution with an api call and show different forms for different resolutions, but this is more work in my opinion.

    I hope this helps!
    LVL 1

    Author Comment

    Thanxs for your reply
    I had done the same before you gave me the answer
    But still for your reply I will give this points to you

    LVL 1

    Author Comment

    And one more
    can u just tell me which api does give the screen resolution
    LVL 6

    Expert Comment

    Ofcourse, here it is:

    'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
    'Insert this code to the module :

    Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Public Const SM_CXSCREEN = 0
    Public Const SM_CYSCREEN = 1

    'Insert this code to your form:

    Private Sub Form_Load()
    Dim Tmp As String
    Tmp = GetSystemMetrics(SM_CXSCREEN) & _
    "x" & GetSystemMetrics(SM_CYSCREEN)
    MsgBox (Tmp)
    End Sub
    LVL 1

    Author Comment

    But this looks more like VB code

    If it is TCL then where do i find
                      Project -> Add Module
    in that


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now