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

Is it possible to dynamically add controls to a dialog box?

chandrika
Beginner
445 Views
Dear Members,
I want to use edit boxes to selectively view the contents of a file, is there any way to specify the number of edit boxes(usingan integer variable, say) in a dialog box at run time?
AlsoI want to update the contents of an editbox, ie add new lines to it while keeping the previous ones, but I cant seem to find a way to accomplish this...
Any assistance with these issues will be greatly appreciated
Regards
Marrisa
0 Kudos
4 Replies
anthonyrichards
New Contributor III
445 Views
You could add the controls and make them invisible at the start, then make them visible later. All resources need to be available and they must either be connected to callback routines or have their ID's dealt with ina subclassed dialog box procedure. see http://tinyurl.com/5gqj3.
You can also add via a hook procedure. Do some searches on this board for 'adding controls' and you will get some useful info.
0 Kudos
chandrika
Beginner
445 Views
Dear Sir,
I searched the message boards like you suggested (I decided to tackle mymultiline problem first) and my search yielded the following subroutine:
SUBROUTINE AppendEditText(Dlg, ID, sText)
TYPE(Dialog):: Dlg
INTEGER:: ID
CHARACTER(*):: sText
CHARACTER(LEN=LEN(sText)+1):: szText
INTEGER:: hwndEdit, i
hwndEdit = GetDlgItem(Dlg%hWnd, ID)
szText=TRIM(sText)//CHAR(0)
nLength = SendMessage ( hwndEdit, WM_GETTEXTLENGTH, 0, 0 )
i = SendMessage ( hwndEdit, EM_SETSEL, nLength, nLength )
i = SendMessage ( hwndEdit, EM_REPLACESEL, 0, LOC(szText))
END SUBROUTINE AppendEditText
I am using it as follows however I cannot see anything in my editbox. I set the properties 'Multiline' and 'Want Return' under the 'styles' tab. Am I implementing it correctly? Any assistance will be greatly appreciated.
retlog = DlgInit( IDD_DIALOG9,dlg )
if ( retlog .eq. .true. ) then
name = 'Chandrika'
call AppendEditText(dlg, IDC_Edit1, name)
iret = dlgmodal(dlg)
end if
Regards
Chandrika
0 Kudos
alcala
Beginner
445 Views
Have you tried, as it was sugested, that link? There is an API function sample:
i = ShowWindow(GetDlgItem(Dlg%hWnd,IDC_WHATEVER),SW_HIDE/SW_SHOW)
regards
Jadwiga
0 Kudos
alcala
Beginner
445 Views
To edit multiline outputs (or whatever) I use ListBox.
Let me know, if you need help with it.
Jadwiga
0 Kudos
Reply