Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Using Dialogs and setting the 'visible' property on controls

jschomaker
Beginner
615 Views
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?
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
615 Views
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.

Jugoslav
0 Kudos
pcurtis
Beginner
615 Views
!
! 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)
IMPLICIT NONE
INTEGER, INTENT(IN) :: hwnd
INTEGER, INTENT(IN) :: controlID
LOGICAL, INTENT(IN) :: visible

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

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

rval = ShowWindow (hwndControl, nCmdShow)

END SUBROUTINE ControlSetVisible
0 Kudos
Reply