How do I get the information for WGLTXT without closing the gui

66 views
Skip to first unread message

Venkat Kolluru

unread,
Dec 7, 2014, 11:48:18 AM12/7/14
to dislin...@googlegroups.com
Hi,
I am doing some testing using DISLIN.
I am able to do some simple GUIs.
In a gui, I want to get the information from WGLTXT without closing the gui using WGFIN.
Is there a way it can be done?

The idea is to keep the gui opened all the time and information will be changed ins some WGLTXT controls which will
be used to runs subroutine through callback. This subroutine uses information from WGLTXT controls.

I tried many different ways. But nothing seems to be working. I have to use WGFIN and then extract the information.

To summarize,
I want to have a gui in which user can change the values and then run a model using a button and check the results in an iterative mode.

Can somebody provide me some tips?

Thanks
Venkat

Helmut Michels

unread,
Dec 9, 2014, 2:30:03 AM12/9/14
to dislin...@googlegroups.com
Hi Venkat,

you can request the value of a text widget with the routine GWGTXT. Normally, a Dislin widget program is
waiting for user input in an event loop, which is located in the WGFIN routine. You can either request the
values of widgets after WGFIN, or in callback routines which are connected to some widgets.

Best regards,

Helmut 

johannes

unread,
Dec 14, 2014, 11:43:12 AM12/14/14
to dislin...@googlegroups.com
Hello Helmut,
perhaps I can formulate Venkats question with other words and post it together with my question:
How can I refresh the parent widget after a request action?

I tried this piece of code hoping that either cstr or text are displayed in WGLAB
program self_refresh
COMMON /com/ text,cstr
Character (LEN=20) cstr,text
External Routine
CALL WGINI('vert',IP)
CALL WGTXT(IP,cstr,IDtxt)
CALL SWGCBK(IDtxt,Routine)
print *,'testprint from main:',text   ! Why is text empty ?
print *,'testprint from main:',cstr
CALL WGLAB(IP,'dummy line',ID)        ! just to see something
CALL WGLAB(IP,text,ID)                ! try to write the string received from callback
CALL WGLAB(IP,cstr,ID)
CALL WGFIN()
END

Subroutine Routine(ID)
COMMON /com/ text,cstr
Character (LEN=20) text,cstr
  CALL GWGTXT(ID,text)
  print *,'Call back Routine: text=',TRIM(text)    ! this is printing the WGTXT content. correct.
    print *,'Call back Routine: cstr=',TRIM(cstr)  ! cstr is empty. ok.
RETURN
END

How can this code be modified, so that the parent window refreshes with the input line being displayed in WGLAB?

regards,
 Johannes

Helmut Michels

unread,
Dec 15, 2014, 2:48:00 AM12/15/14
to dislin...@googlegroups.com
Hi Johannes,

the callback routine is not called directly after WGTXT. The routine SWGCBK enables just a callback routine, but does not
call it. Instead, the callback routine is called in WGFIN in an event loop when a user changed the text in the text widget.
So, the callback routine is called after your print statements. If you want to change the text in a label widget, you can do this
in the callback routine with SWGTXT. For that case the parent widget will be refreshed.

Best regards,

Helmut

johannes

unread,
Dec 15, 2014, 9:39:48 AM12/15/14
to dislin...@googlegroups.com
Hi Helmut,
thanks for assistence. For all other people, this is a working pice of code:
program self_refresh
COMMON /com/ text,IP,ID2
Character (LEN=20) text

External Routine
CALL WGINI('vert',IP)
CALL WGTXT(IP,cstr,ID1)
CALL SWGCBK(ID1,Routine)
print *,'testprint from main:',text  ! would never deliver a strig
CALL WGLAB(IP,'dummy line',ID3)  ! just to see something
CALL WGLAB(IP,text,ID2)   ! try to write the string from manual input.
CALL WGFIN()
END

Subroutine Routine(ID1)
COMMON /com/ text,IP,ID2
Character (LEN=20) text
  CALL GWGTXT(ID1,text)

  print *,'Call back Routine: text=',TRIM(text)
  CALL SWGTXT(ID2,text)   ! try to write the string from manual input.
RETURN
END


regards,
Johannes
Reply all
Reply to author
Forward
0 new messages