No announcement yet.

Creating/modifying controls on the fly

  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating/modifying controls on the fly

    I'm having some trouble getting to grips with creating dialogs using PowerGen. I have written a Win 3.1 app with VB4 and I want to compile it with PB/DLL 2. It is a fairly simple app but it's quite dialog-intensive. I need to be able to add, move and resize controls on the fly and so far it is completely beyond me. VB makes it so simple <sigh>.

    Does anyone have a simple example of how to do this? The simpler the better...
    Or if some kind soul wanted to write some sample code for the benefit of myself and other would-be VB converts, the ideal example would be a form with a button that on the first press creates, say, a text box.
    On the second press it moves the textbox, and on the third press resizes it.
    Or something along those lines, bearing in mind that all people like me know is "Load frmMain.Text(1)" and "frmMain.Text(1).left=xxx" etc. Long detailed comments are GOOD...

    Any help will be very much appreciated.

    Ray Greene

  • #2
    I highly recommend that you get yourself a copy of Charles Petzolds "Programming Windows 3.1".. unfortunately it is out of print, but is often located in 2nd hand book shops... I picked up a copy I found online from a small shop in Canada for about CAN$12.

    Petzold describes the basic API's you'll need to achieve your goals... CreateWindow(), MoveWindow(), SetWindowPos(), etc.

    Also, did you examine the example files that came with PB/DLL 2.0? The a "basic" example of creating controls dynamically appears in the MODVIEW example file...

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


    • #3
      Thanks Lance. I had overlooked modview.bas but it has what I was looking for.
      I'll try to get the Petzold 3.1 book. I have a copy for Win98, but obviously a huge amount of it will not apply to 3.1.

      Ray Greene.