Announcement

Collapse
No announcement yet.

Adding code to the output of PowerGen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding code to the output of PowerGen

    I've made a main dialog with a control button on it
    that calls a second dialog when the button is clicked.
    The second dialog has a list control that is intended
    to have the numbers 5 thru 49 selected. Of course
    DLGEDIT leaves the values to be loaded into the list
    up to code I have provide. (I haven't yet figured out
    what the Lbxxxx code should look like, but I'll get
    it).

    The main Dialog calls the second with the following
    code.

    CASE %Second
    SELECT CASE HIWRD(wParam)
    CASE %BN_CLICKED
    DialogBoxParam ghInst, BYVAL CLNG(%SecondDialog),
    hDlg, CODEPTR(SecondDialog_WndProc), 0
    END SELECT

    Right now I'm using DLGEDIT and PowerGen to regenerate
    ALL code EVERY TIME I make a change, and that is
    occurring frequently since this is my first Windows
    program. I've concluded that I don't want to modify
    the code generated by PowerGen, other than add an
    #include at the begginning for my code procedures.

    If I follow that process I don't see any way to load
    the values (5-49) of the list when the second dialog
    is displayed.

    How can I get control when the second dialog is
    created and displayed. Must I insert code to
    display variable information at the start of
    SecondDialog_WndProc procedure? If so I have to do
    that every time I run PowerGen and create new code?
    Is there a simpler more automatic way to do this?

  • #2
    Joe, PowerGEN is a "run once" application. By that I mean that once you create your GUI, you don't regenerate your code template, instead you just add code to it like a "normal" program.

    If you want to add controls to your dialog, then there are several ways of handling this.

    (I'm being called away... I'll finish this reply when I get back... sorry!).

    -------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Carrying on from where I left off...

      1. Re-edit your RC file (adding controls, etc) and recompile the RC->RES->PBR, but don't regenerate the template... instead, manually write in the event handlers as required for the new functions. This means that you never generate the template more than once, but you may end up writing a few event handlers manually.

      2. Use PowerGEN in "single dialog mode", and generate an individual dialog handler BAS file, then manually cut/paste the new file into the original template. A bit messy but it works if handled with care. Again, you never regenerate the main application template more than once. (This is the technique I use myself).

      3. Write and keep all of your actual "computational code" in a separate INC file, but I suggest that you write this code so that it can replace the INC file generated by PowerGEN. In other words, each time you regenerate your application template with PowerGEN, simply replace the generated INC file with your own INC file (change the $INCLUDE line in the BAS file). At worst, you may have to cut/paste some of the new wrapper functions that the newest INC file contains.

      4. Use a "merge" utility. This is just an idea, but it seems plausable to merge your hand-edited template code with a fresh application template, thereby resulting in a code template that combines the hand-edited code with the most recent generated code. A utility like "MERGE 5.0" could be worth a go. Disclaimer: I've never tried to merge code like this nor used "MERGE 5.0"... it's just an idea.

      Anyone else have any tricks up their sleeve?

      -------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment

      Working...
      X