- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am programming a windows application. In a dialogue (modeless) I want to disable/enable controls dependent about defined conditions..
Can anybody advise?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use ifwin, only: GetDlgItem, EnableWindow, ShowWindow, SW_SHOW, SW_HIDE, TRUE, FALSE, handle, bool implicit none integer (bool) :: bret integer handle :: hwnd, hdlg hwnd = GetDlgItem(hDlg, ID_CONTROL) ! get control handle using dialog handle and control index bret = EnableWindow(hwnd, TRUE ) ! enable control bret = EnableWindow(hwnd, FALSE ) ! disable control bret = ShowWindow( hwnd, SW_SHOW ) ! make control visible bret = ShowWindow( hwnd, SW_HIDE ) ! make control invisible
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is an example from VS Help:
BOOL CMyFileDialog::OnInitDialog()
{
CFileDialog::OnInitDialog();
CWnd* pWndParent = GetParent();
//make sure you add #include <dlgs.h> for IDs 'edt1' & 'stc3'
//disables the 'file name' edit and static control
//of the standard file open dialog
//get handle of 'file name' combobox control & disable it
CWnd* pWnd = pWndParent->GetDlgItem(cmb13);
pWnd->EnableWindow(FALSE);
//get handle of 'file name' static control & disable it
pWnd = pWndParent->GetDlgItem(stc3);
pWnd->EnableWindow(FALSE);
return TRUE;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Luigi,
I forgot to mention that I am writing in Visual Fortran ...Have not the possibility to apply other languages :-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this a quickwin (iflogm) or a windows api dialog? The answer would be different for each.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is a windows application, not quickwin..
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have created a modeless dialog with its controls using fortran it should be simple to call the 'EnableWindow()' function using Fortran syntax. System calls do not change with language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use ifwin, only: GetDlgItem, EnableWindow, ShowWindow, SW_SHOW, SW_HIDE, TRUE, FALSE, handle, bool implicit none integer (bool) :: bret integer handle :: hwnd, hdlg hwnd = GetDlgItem(hDlg, ID_CONTROL) ! get control handle using dialog handle and control index bret = EnableWindow(hwnd, TRUE ) ! enable control bret = EnableWindow(hwnd, FALSE ) ! disable control bret = ShowWindow( hwnd, SW_SHOW ) ! make control visible bret = ShowWindow( hwnd, SW_HIDE ) ! make control invisible

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page