Using Dialogs and setting the 'visible' property on controls

Using Dialogs and setting the 'visible' property on controls

If I have an edit box control (named IDC_NAME) in a dialog, is there any way to make the edit box appear and disapper during run-time? You know how you can make an edit box be enabled or disabled during run-time by doing something like this: lret = DlgSet (dlg, IDC_NAME, .FALSE., dlg_enable) to disable it and something like this to enable again:
lret = DlgSet (dlg, IDC_NAME, .TRUE.,dlg_enable). There is a 'visible' property you can check and uncheck, but how do you make it visible or invisible during run-time as with the enable/disable feature?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

a) You can use ShowWindow(GetDlgItem(Dlg%hWnd, IDC_EDIT_X), SW_SHOW/SW_HIDE) APIs (USE DFWIN). That will work only from callback functions, though (not from the same routine you call DlgInit);

b) You can download my "tweaked" version of DFLOGM from my home page which, among other extensions, supports DLG_VISIBLE property for all controls.


! Sets the visible state of a control in a dialog box. Hidden
! controls (visible = false) are not drawn and cannot be used.
SUBROUTINE ControlSetVisible(hwnd, controlID, visible)
LOGICAL, INTENT(IN) :: visible

INTEGER :: rval
INTEGER :: hwndControl
INTEGER :: nCmdShow

hwndControl = GetDlgItem(hwnd, controlId)
IF(visible) THEN
nCmdShow = SW_SHOW
nCmdShow = SW_HIDE

rval = ShowWindow (hwndControl, nCmdShow)

END SUBROUTINE ControlSetVisible

Leave a Comment

Please sign in to add a comment. Not a member? Join today