Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29327 Discussions

Difference between DLG_ADDSTRING and LB_ADDSTRING

Lars_Jakobsen
Beginner
711 Views
Hi all,
I am currently trying to develop a dialogthat has a listbox named IDC_VISIBLE in it and a button to add an item to the listbox. There are at least two methods of populating the listbox, however I amconfused by the difference in subsequent behaviour of the listboxwhen using either

lret = DLGSET(dlg, IDC_VISIBLE, Text, DLG_ADDSTRING)
or
iret= senddlgitemmessage(dlg%hwnd, IDC_VISIBLE_LB_ADDSTRING, 0, loc(Text)).

Both will add a string to my listbox, however when I subsequently try using

iret = senddlgitemmessage(dlg%hwnd, IDC_VISIBLE, LB_FINDSTRING, 0, loc(Text))

the differences begin. When using dlg_addstring the application cannot findText (return code -1) but if I am using LB_ADDSTRING it does find Text (return code index to Text).

For other reasons (mostly reuse of code) I would like to use DLG_ADDSTRING (as it updates the numitems used by dlgget(dlg, idSrc, NumSrc) used in another subroutine). I have searched forbut did not find any descriptions on the difference in behaviour when using dlg_addstring or lb_addstring (or dlgset as opposed to sendmessage)- can anybody tell me the difference or does anybody know where I can read about the difference?

Regards

Lars
0 Kudos
3 Replies
anthonyrichards
New Contributor III
711 Views
Try using CALL DLGFLUSH (dlg [, flushall]) with flushall = .false. after your DLGSET. See the Help for DLGFLUSH.
0 Kudos
Lars_Jakobsen
Beginner
711 Views
That worked - thank you.

Does this mean, that there should not be any difference in using dlgset(...,DLG_ADDSTRING) or sendmessage(...,LB_ADDSTRING)?

Along the line -I was wondering about when to use DLGMODELESS and when to use CreateDialogParamto create the dialog from a resource- I settled on the DLGMODELESS approach, but are there any guidelines?

Again - thank you for the help.

Lars
0 Kudos
anthonyrichards
New Contributor III
711 Views
Personally, I always use DLGINIT (or DLGINITWITHRESOURCEHANDLE) to load a dialog and usually use DLGMODAL by changing the DLGMODELESS and deleting the message loop for a modeless dialog that a new default dialog application provides. I match the DLGINIT with a DLGUNINIT when the dialog exits. I have found this works fine.
0 Kudos
Reply