November 01, 2025, 05:34:05 PM

News:

IWBasic runs in Windows 11!


Dialog editor

Started by Rock Ridge Farm (Larry), December 08, 2008, 02:58:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rock Ridge Farm (Larry)

Is the source for the Dialog editor on the allsource CD or somewhere else?
Is it available?

Ionic Wind Support Team

Yes.  IT is on the all source CD, ebdev or adev projects.

But you really wouldn't want to base any work on them as they are 100% C++ MFC driven and very specific to the IDE.

Paul.
Ionic Wind Support Team

AdrianFox

Just a thought on the Dialog Editor.
  When someone completely new to EB tries it out, a number of things happen which takes a while to sort out.  Should the Dialog Editor be modified to take this into consideration....

       1. The novice designs his dialog with a couple of buttons etc.
       2.  He/she views it in the D.E. and it looks ok
       3.  He generates the code and the skeleton handler.

Adrian Fox

AdrianFox

SORRY POSTED THE LAST BIT BY ACCIDENT... WILL FINISH MY POSTING

I hope the following comments might be helpful especially to new users of EB and the editor.

Just a thought on the Dialog Editor.  I can't believe that what happened to me when I first came across EB and used the editor for the first time, is uncommon but it  is most off-putting and I would have thought avoidable with a couple of simple changes to the editor.

  When someone completely new to EB tries it out, a number of things happen which takes a while to sort out.  Should the Dialog Editor be modified to take this into consideration....?  People always want instant gratification and instant results so what happens is this....

       1. The novice designs his dialog in the DE with a couple of buttons etc.
       2.  He/she views it within the D.E. and it looks ok
       3.  He generates the code and the skeleton handler and pastes it into a new window.
       4.  Being impetuous he tries to compile it immediately (Build Single) to see if it works. 
       5.  All he sees is a blank screen and can't understand why.  He looks in the Users' Guide.  Finds 'DoModal'.
       6.  He puts in 'DoModal' and tries again. He hasn't put in any run=1:waituntil run=0 etc so almost nothing happens.
       6.  He finds this and does it.  The compiler refuses to work as the program is still open from the previous compile.
       7.  Eventually he re-saves the eba file as something else and tries again with 'Build Single'.  Hurray, it works!   BUT
       8.   The dialog editor only creates the code  'CloseDialog d1' in the d1_handler.  So the program remains open after compile
             and execution  as there's no END statement.
       9.  Having written some more code, the novice or dummie tries to 'Buld Single' again, and discovers the same compile error.
     10.   Eventually it dawns on him that there isn't an END anywhere in the generated code and he puts it right.
     11.   The files once open/being executed are extremely difficult to close, even with task manager, so can cause the novice lots of
            headaches.

I'm sure I can't be  the only beginner  who has tried out the editor to whom all this has happened. OK, it's a good learning process to find out what you've been doing wrong, but  I was put off trying out EB properly for over a year having been defeated initially by the Dialog Editor in this way.  There may be a lot of people out there who've tried out EB once or twice and given up for this reason, never appreciating the real potentials for the language.

I can't see why the Dialog Editor couldn't generate both the  'DoModal d1' code (and the 'Run/Waituntil' to create the pause) and the 'End' code in the d1_handler.  There could be REMs to remind users that the END should be removed when in normal use as a second or subsidiary dialog, and explaining the purpose of DoModal/Run/Waituntil  ?

If a beginner can get immediate successful results he or she is encouraged and will likely go on the master the program (and more important BUY a copy).  If he's put off at the start then he's likely discouraged.  I know that studying the Users Guide is the eventual solution to most problems, but at the very start people need all the help they can get.


Adrian Fox

Ionic Wind Support Team

Adrian,
The only purpose of the dialog editor is generating the code statements to position controls and give you a skeleton handler to work with.

-DoModal isn't the only way to show a dialog.
-END isn't generally needed and is inserted automatically anyway by the compiler.
-When you use DoModal you never need another WAITUNTIL, so you are coding something wrong.

For example this is a complete program, no END in site and it run and will exit properly.   I only added two statements after generating the code with the dialog editor, one of course was the DoModal statement which shows the dialog and has its own message loop provided by Microsoft.  The other was the code for the button.


CONST BUTTON_1 = 1
DIALOG d1
CREATEDIALOG d1,0,0,300,133,0x80C80080,0,"Close Me",&d1_handler
CONTROL d1,@SYSBUTTON,"Click Me",115,91,70,20,0x50000000,BUTTON_1

DoModal d1

SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON_1
IF @NOTIFYCODE = 0
/*button clicked*/
CLOSEDIALOG d1,@IDOK
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB


The other way to show a dialog is ShowDialog.   And you would use ShowDialog in an already existing program, which would have a message loop anyway. 

The users guide explains the difference. 

With that said I am working on a visual IDE and designer for Emergence, which will give you more of a skeleton to work with, but it is still up to you to flesh out a program, and read the users guide to learn how. 

Paul.
Ionic Wind Support Team

AdrianFox

Paul,

:o :o
Of course, you are completely right Paul!  Now I feel REALLY stupid.   I tried your code snippet, still couldn't quite believe it, made my own quick dialog and of course everything works perfectly, no problem.

What completely confuses me now is just WHAT I kept doing many months ago when I started and kept getting the files being left open as I said.

I assume the earlier versions of EB wouldn't have done what I claimed  either?

The only solution is for me to search through some of the old code I created at that time if I can find it, and see if I can understand what I was doing early on.

Thanks for your patience. 

Adrian
Adrian Fox

AdrianFox

Was easy to find  and replicate my stupid error.

What I used to do was follow the Window example and think I had to put ' run=1: waituntil run=0' after domodal.

When you do this, a dialog box program won't end properly with just closedialog as it's waiting for run to =0, but by putting 'End' after closedialog  this allows it to close.



Adrian
Adrian Fox