How to create a popup window

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi everybody,

 

I would like to know the command to create a popup window like in the attached file:

 

I know that the window will appear by usage of command:

 

tk_messageBox -message 'some message' -type yesno

 

 

But is it possible to define a user specific input and add a image?

 

Thanks in advance

 

 

<?xml version="1.0" encoding="UTF-8"?>Q4.png

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited July 2018

    Hi,

    It is possible, you will have to create a GUI with the help of tk. 

    https://www.tutorialspoint.com/tcl-tk/tk_basic_widgets.htm

    You can also refer to HWTK GUI Toolkit available in Start>Programs>Altair Hyperworks 2017>Tools

    image.png.30f93bf1499255cae4ad4f5a0da70065.png

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Livil Lyle

     

    thank you for the quick answer and the link! This is the answer to my questions and I'll try to build up me dialog box!

     

    Many thanks

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Hi,

     

    which comand do I have to use instead of 'set w [hwtk::demo::getpreviewframe]' to set this variable in HyperMesh?

     

     

    # HWVERSION_14.0_Feb 5 2016_17:42:29
    #Get preview frame
    set w [hwtk::demo::getpreviewframe]

    set input [hwtk::inputdialog -initialvalue testing -text testing -inputtype str \
        -x [winfo rootx $w] -y [winfo rooty $w]]

    tk_messageBox -title 'hwtk::inputdialog' -message 'Return value: $Input'

     

     

     

    Thanks in advance!

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited July 2018

    Hi,

    Try:
    set w [toplevel .mydialog] instead of 'set w [hwtk::demo::getpreviewframe]

     

    I would recommend you to manually create label, entry box and buttons instead of hwtk::inputdialog.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Hi,

    Try:
    set w [toplevel .mydialog] instead of 'set w [hwtk::demo::getpreviewframe]

     

    I would recommend you to manually create label, entry box and buttons instead of hwtk::inputdialog.

     

    Hi,

     

    thanks for your answer!

     

    ok what do you mean by manually create instead of hwtk::inputdialoge?

     

    as mentoined before, I would like to build a dialog box like in the picture in my first post...

    do you have an example how to do this?

     

    thanks in advance

     

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2023

    Hi,

     

    I did a sample for you to get started. Please find the attachment.

     

    Regards,

    llyle

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2023
    7 minutes ago, Livil Lyle said:

    Hi,

     

    I did a sample for you to get started. Please find the attachment.

     

    Regards,

    llyle

     

    Thank you very much!

     

    best regard

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Livil Lyle,

     

    Could you please give me a hint, how to add an image?

    Like shown in my first post on the upper right hand side...

     

    thanks in advance

    Regards

    0815

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2023

    Hi @0815

    You will have to work with frames as in attachment. 

    Regards

    llyle

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2023
    18 minutes ago, Livil Lyle said:

    Hi @0815

    You will have to work with frames as in attachment. 

    Regards

    llyle

     

    Thank you very much!

     

    Regards

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Hi,

     

    I created my pop up windows and everthing works fine, if I start them one by one!

     

    In a second step I would like to summarize them in one tcl-file.

     

    Therefore I did something like this:

     

     

     

    set question1 [tk_messageBox -message 'Do you want to execute first pop up window?' -type yesno -icon question]
    switch -- $question1 {
        yes {*evaltclscript 'my_first_popup.tcl' 0
    }
     no {}
    }

    set question2 [tk_messageBox -message 'Do you want to execute second pop up window?' -type yesno -icon question]
    switch -- $question2 {
        yes {*evaltclscript 'my_second_popup.tcl' 0
    }
     no {}
    }

     

     

     

    The issue is, that if I say 'yes' to the first question ($question1 ), the second message box ($question2) appears too...

    which command do I have to use if I want the second messagebox to appear after finishing the execution of the first popup.tcl?

     

    Thanks in advance

     

     

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2023

    Hi @8015,

    you will have to tie the *evaltclscript 'my_second_popup.tcl'  to a proc which runs after the close of your my_first_popup.tcl. Please see the attachment on how you can do the same.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    Hi,

     

    works perfectly!!!! :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />

     

    Thank you very much for your support!

     

    I love this forum you guys are great!