Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

DISABLE LIST AND TEXT BOXES IN WIN 32

kooka
초급자
867 조회수

HI, I AM MAKING A PROGRAM IN WIN32, BUT NOW I AM STOPPED, I WAS TRYING TO DISABLE/ENABLE SOME CONTROLS IN A MODELESS DIALOG BOX, BUT I CAN ONLY DISABLE/ENABLE THE EDIT BOX CONTROLS, SO I CAN'T DISABLE/ENABLE RADIO BUTTONS ANDCOMBO BOX AND TEX BOX CONTROLS, I PASTEMY DIALOG PROCEDURE, WHERE I CALL SenddlgitemMessage MESSAGE TO DISABLE THE CONTROLS. PLEASE HELP!:

integer(4) function TendonDataDlgProc( hDlg, message, wParam, lParam )
! Processes messages for "TendonData" dialog box
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_TendonDataDlgProc@16' :: TendonDataDlgProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'TendonDataDlgProc' :: TendonDataDlgProc
!DEC$ ENDIF
use comctl32
use dfwina
use Globals
implicit none
integer hDlg ! window handle of the dialog box
integer message ! type of message
integer wParam ! message-specific information
integer lParam

!DECLARES HANDLES TO THE CONTROLS
!DECLARA HANDLES PARA LOS CONTROLES
integer(4) HDA
integer(4) HJF1
integer(4) HJF2
integer(4) HFE
integer(4) HSE
integer(4) HBE
integer(4) HPF
integer(4) HTIME

integer(4) HJACK
integer(4) HTDA
integer(4) HTJF1
integer(4) HTJF2
integer(4) HTFE
integer(4) HTSE
integer(4) HTBE
integer(4) HTPF

include 'resource.fd'
! Variables
integer(4) iret
logical(4) result, bret
character(80) text
type (T_INITCOMMONCONTROLSEX) iccex

!GETS HANDLES TO THE CONTROLS(NOW I DON'T USE THEM)
hDA = GetDlgItem(hDlg,IDC_DA)
hJF1 = GetDlgItem(hDlg,IDC_JF1)
hJF2 = GetDlgItem(hDlg,IDC_JF2)
hFE= GetDlgItem(hDlg,IDC_FE)
hSE= GetDlgItem(hDlg,IDSE)
hBE = GetDlgItem(hDlg,IDC_BE)
hTIME = GetDlgItem(hDlg,IDC_TIME)
HPF= GetDlgItem(hDlg,IDC_PF)

hJACK = GetDlgItem(hDlg,IDC_JACK)
hTDA = GetDlgItem(hDlg,IDC_TDA)
hTJF1 = GetDlgItem(hDlg,IDC_TJF1)
hTJF2 = GetDlgItem(hDlg,IDC_TJF2)
HTPF= GetDlgItem(hDlg,IDC_TPF)

select case (message)
case (WM_INITDIALOG)

TendonDataDlgProc = 1
return

case (WM_COMMAND) ! message: received a command
!ENABLE/DISABLE CONTROLS WHEN I PRESSA RADIO BUTTON
if (LoWord(wParam) .EQ. IDC_pre1) then

!THESE WORKS(EDIT BOX CONTROLS)

iret = SendDlgItemMessage(hdlg,idc_da,WM_ENABLE,.FALSE.,0)
  ; iret = SendDlgitemMessage(hdlg,idc_jf1,WM_ENABLE,.FALSE.,0)



!THESE DOESNT WORKS, (RADIO BUTTONS, COMBO BOX AND TEXT BOX CONTROLS)

iret = SendDlgItemMessage(hdlg,idc_tda,WM_ENABLE,.FALSE.,0)
iret = SendDlgitemMessage(hdlg,idc_tjf1,WM_ENABLE,.FALSE.,0)
iret = SendDlgItemMessage(hdlg,idSE,WM_ENABLE,.FALSE.,0)
iret = SendDlgitemMessage(hdlg,idc_BE,WM_ENABLE,.FALSE.,0)


TendonDataDlgProc = 1
return
end if
if (LoWord(wParam) .EQ. IDC_post1) then

!WORKS

iret = SenddlgitemMessage(hdlg,idc_DA,WM_ENABLE,.TRUE.,0)
iret = SenddlgitemMessage(hdlg,idc_JF1,WM_ENABLE,.TRUE.,0)

!DOESNT WORKS
iret = SenddlgitemMessage(hdlg,idc_tDA,WM_ENABLE,.TRUE.,0)
iret = SenddlgitemMessage(hdlg,idc_tJF1,WM_ENABLE,.TRUE.,0)
iret = SenddlgitemMessage(hdlg,idSE,WM_ENABLE,.TRUE.,0)
iret = SenddlgitemMessage(hdlg,idc_BE,WM_ENABLE,.TRUE.,0)

TendonDataDlgProc = 1
return
end if
if (LoWord(wParam) == IDOK) then
! Exit the dialog

iret = DestroyWindow (hdlg)
ghDlgModeless = 0
TendonDataDlgProc = 1
return
end if
end select
TendonDataDlgProc = 0 ! Didn't process the message
return
end

0 포인트
3 응답
Jugoslav_Dujic
소중한 기여자 II
867 조회수
WM_ENABLE is a notification message, i.e. it's a consequence of window being en/disabled, rather than command to en/disable the window. Instead, use
iret = EnableWindow(GetDlgItem(hDlg, IDC_XX), TRUE/FALSE)

A couple of remarks:

  1. You should use TRUE and FALSE (integer constants declared in IFWIN) rather than logical .TRUE. and .FALSE. as arguments to Win32 functions. While the latter will almost certainly work, it's better to be safe than sorry.
  2. Please don't type in ALL CAPS. It is considered rude in the internet.

0 포인트
kooka
초급자
867 조회수
So tanks Jugoslav, your code works very well. I can solve my problem, I i still have a dude, why iret = SendDlgItemMessage(hdlg,idc_da,wm_enable,.FALSE.,0) works with edit boxes and not for other controls?, tanks buddy!
0 포인트
Jugoslav_Dujic
소중한 기여자 II
867 조회수
It doesn't quite work even there, if you take a closer look: the control is grayed, but you can still type in it. Apparently, edit box uses WM_ENABLE to adjust its colors, and other control probably use diffrent mechanisms.
0 포인트
응답