en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en en en fr en en en fr en da de en en en en en nl en en en en en en en sv en en sv en en en en en en en nl en en en fr en en en en en fr en da en en en en en en en nl en en pt en pt en it en en en en eo en eo en en en en en en en nl en en en en en en en en en en en en en en en en sv en en sv en en en en en en en nl en en en en en en en en en en en en en en en nl vi en en en en en en en en en fr en da en en fr en en en en nl en en en en en en en fr en en fr pt en en en en en en en nl fr en en en en en en en en en en fr en da en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
DDT: LABEL won't show on dialog
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
Here is a problem I cannot seem to figure out. Using PB.DLL 6.0, DDT style:
I have a dialog which I SHOW MODAL ; it works fine.
In a callback function for one of the buttons, I want to create a modeless dialog to show that I am processing a long function.
The idea is to do this:
What is happening is the modeless dialog is launched and dies at the correct time with the caption, but the "LABEL" on that dialog does not appear. I just get a blank "dialog client area" (below the caption).
I have tried using LOCAL and GLOBAL dialog handles, real ID's and -1 for the LABEL control, inserting a DIALOG DOEVENTS, even played with the X and Y of the DIALOG NEW statement itself.
I even tried creating (DIALOG NEW..CONTROL ADD..) the modeless dialog in WinMain when I create the "main" dialog and then just doing the DIALOG SHOW in the above callback function.
On one try and one try only did I get the text to appear, but that was when I made a mistake and did a DIALOG END of the WRONG dialog.
Eventually I want to change the LABEL control into a "progress bar" control, but until I can get a simple label to show up I'm a little reluctant to go hacking up my main processing code (to keep track of the percent done).
Can anyone tell me what I am missing here?
Is it something simple? Will I be saying, "duh?"
Port Washington WI USA
Join Date: Aug 1998
3 Sep 2000, 11:01 AM
In 'Control Add Label..' you have overridden the default style-setting with %SS_LEFT as your only style.
You have to add %WS_CHILD at least.
Join Date: Aug 1998
3 Sep 2000, 11:56 AM
Good thought, and it's one I did not try because my "main" dialog uses only %SS_LEFT on six other lables and everything shows up just fine.
I made it %SS_%LEFT OR %WS_CHILD OR %WS_VISIBLE, and I get the same results as before.
Port Washington WI USA
Join Date: Sep 1999
3 Sep 2000, 12:39 PM
IF CBMSG = %BN_CLICKED
IF CBCTLMSG = %BN_CLICKED THEN
So the code will execute... Also note that Lance has always
stated that a modeless dialog needs a message pump. I don't know
if that comes into play in this situation but I would assume so.
Join Date: Aug 1998
3 Sep 2000, 12:48 PM
Well, I missed that you were showing a modless dialog in a
Your callback will not return   no messages handled until
you have ended your modless dialog.
You will need a lot of Dialog DoEvents in your 'LongRunningFunctionWhichDoesNOGUI '
I am not doing that much DDT, so I cannot tell if this is a less efficient
way to do it.
I prefere to start this kind of operations in a separate thread and
let this Thread set a flag when finished.
DIALOG SHOW MODELESS ghWaitDlg TO WaitResult Dim P as MyThreadUDT P.RetCode = 0 P.OtherParms = ... Thread Create LongRunningFunctionWhichDoesNOGUI(Byval VarPtr(P)) to ThreadId& Thread Close ThreadId& to ThreadId& Do ' Allow messages to be dispatched Dialog DoEvents ' Query the Thread global flag Loop While P.RetCode = 0
Join Date: Oct 1998
3 Sep 2000, 01:39 PM
Maybe the following code will help... I put the message pump inside
#COMPILE EXE #DIM ALL #INCLUDE "win32api.INC" DECLARE CALLBACK FUNCTION DoItCallBack() DECLARE SUB longRunningSub() GLOBAL ghDlg AS LONG, ghWaitDlg AS LONG FUNCTION PBMAIN LOCAL hDlg AS LONG DIALOG NEW 0, "Test", , , 200, 85, %WS_SYSMENU + %WS_CAPTION TO ghDlg CONTROL ADD BUTTON, ghDlg, %IDOK, "&Ok", 5, 20, 90, 14 DIALOG SHOW MODAL ghDlg CALL DoItCallBack END FUNCTION CALLBACK FUNCTION DoItCallBack() AS LONG LOCAL waitResult AS LONG SELECT CASE CBMSG CASE %WM_COMMAND SELECT CASE CBCTL CASE %IDOK DIALOG NEW ghDlg, "Caption....", , , 150, 60, %DS_CENTER OR %WS_CAPTION TO ghWaitDlg CONTROL ADD LABEL, ghWaitDlg, -1, "Please Wait...", 10, 30, 100, 14, %SS_LEFT DIALOG SHOW MODELESS ghWaitDlg longRunningSub DIALOG END ghWaitDlg END SELECT CASE %WM_DESTROY DIALOG END ghWaitDlg END SELECT END FUNCTION SUB longRunningSub() LOCAL i AS LONG FOR i = 1 TO 2000 DIALOG DOEVENTS NEXT i END SUB
Join Date: Aug 1998
3 Sep 2000, 04:28 PM
Well, guys, putting some DIALOG DOEVENTS in the LargeSubWhichDoesNoGUI did the trick; thanks for the tips.
I had to "tune" how often I did it, or it got real slow.
Now that I got the label working, I can at least ship it out to the customer; he can use it "as is" until I get the Progress Bar working to replace the simple label.
PB should really think about adding some documentation on this:
Who'd a thunk "DIALOG SHOW" would *not* show all the controls unless you call DIALOG DOEVENTS several times???
Port Washington WI USA
Join Date: Aug 1998
3 Sep 2000, 11:47 PM
Michael, the section on modeless dialogs in the chapter "Dynamic Dialog Tools" does describe using a message pump, and a simplistic example of a message pump. However, I'll ask the documentation department to make this point clearer in the next update to the documentation.
Also I should point out that the ADDRESS.BAS example code also shows how to create a message pump for a modeless dialog too.
Finally, it is worth noting that DDT modeless dialogs operate just like conventional SDK-style modeless dialogs, in that a message pump must be running for messages in the message queue to be dispatched and processed. Most (if not all!) Windows GUI programming books explain modal and modeless dialog theory in great detail. Having such a book in your collection can often prove a valuable addition to the reference library you no-doubt already have!
I hope this helps.
Join Date: Aug 1998
4 Sep 2000, 04:44 AM
Why, yes, I do have a good reference library, and I have used it to learn "the API way" of doing Windows(r) programs.
This little excursion is a good example of "why it's good to learn the long way before using a programming tool such as DDT."
Intuitively, I thought DIALOG SHOW would, well, "show" the whole dialog with all its controls, essentially taking over the system until the modeless dialog reached input idle, having processed all the messages associated with the creation and presentation of a dialog box.
But that's not how DIALOG SHOW MODELESS works.
Well, that's why we experiment: to see what happens.
At least it's not as "hidden" as some of those "objectname.thingtodo" syntax items in certain other development products.
Port Washington WI USA
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 09:48 PM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.