Announcement

Collapse
No announcement yet.

Dialog boxes

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

  • Jeffrey Morris
    replied
    Lance, I got the "WIN32 Programming" book today and looked through it. I downloaded the Borland C++ compiler on Saturday. I found out that there "WIN32 System Programming" book. I will visit their web site and find out about the book. Jeffrey.

    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    Jeffrey, your project involves creating a non-standard user interface (pressing letters or digits without the ALT key). To accomplish this variation of the user interface, you have to be able to capture keystroke messages and handle the event processing yourself.

    When you use a dialog, the translated keystroke messages are sent to the control with focus, so (as Scott and others have pointed out), you have to subclass all controls that may have keyboard focus.

    Subclassing all of your controls is quite simple (you can do it with a single callback function for all of the control), but whan happens when no controls have focus? Where do the keyboard messages go? Generally speaking, the dialog box engine simply "swallows" them. hmmm... now we are stuck... or are we?

    So what is needed is to intercept the messages before the dialog box engine gets them. How is this accomplished? Ok, for starters, you need to use a Modeless dialog and provide your own message pump - you can't use a modal dialog as the dialog box engine provides it's own message pump and your cannot "intercept" it, but your own code is responsible for the message pump for a modeless dialog.

    If you understand what I'm saying at this point, you'll be able to solve this programming problem quite easily. If you cannot follow, then you need a greater understanding of how Windows operates "behind the scenes".

    I suggest that you carefully study a good Windows programming book like the ones suggested in the FAQ forum.


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

    Leave a comment:


  • Jeffrey Morris
    replied
    Scott, Is it possible for me to subclass push buttons so that when I press a key, the code presses the button. I know about the "&" character that underlines the letter so that I can press ALT-letter keys but this doesn't work with number keys or function keys. Jeffrey.

    ------------------

    Leave a comment:


  • Scott Turchin
    replied
    Actually you CAN do it, but you just may need to subclass it.
    I wrote that Bitswap program and it's near identical to an inputbox in size, and it subclasses the text box on it to check for keystrokes...it checks ot make sure only 0-9 and A-F are entered...

    I can send you the source to it if interested...

    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    [This message has been edited by Scott Turchin (edited April 09, 2000).]

    Leave a comment:


  • Jeffrey Morris
    replied
    Scott, You can't use DDT if you want your program to process keystrokes because DDT and WIN32API don't go well together. Jeffrey.

    ------------------

    Leave a comment:


  • Scott Turchin
    replied
    You might check the source code forum, seems someone just posted one in there not too long ago...

    Personally, I'd use DDT, probably take 5 minutes to create the function and callback for it....that'd be the EASIEST way to do it...
    Let me know if you need a hand, I may have some time tonight and can help you out (Yes, me, free time, first time in MONTHS!!)...


    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Jeffrey Morris
    replied
    Lance, How can I change the subroutine that calls the INPUTBOX$ function into a dialog box using WIN32API calls? How can I process the "OK" and "Cancel" buttons on the input box? Jeffrey.

    Code:
    sub inputbox01
      do
        string07=inputbox$("Enter Station Number")
        number01=val(string07)
      loop until number01=>0 and number01<=45
      if number01=0 then
          call deleteobject(hfont)
          call postquitmessage(0)
      end if
      if number01=1 then stationnumber=6
      if number01=2 then stationnumber=15
      if number01=3 then stationnumber=21
      if number01=4 then stationnumber=542
      if number01=5 then stationnumber=552
      if number01=6 then stationnumber=281
      if number01=7 then stationnumber=544
      if number01=8 then stationnumber=543
      if number01=9 then stationnumber=31
      if number01=10 then stationnumber=49
      if number01=11 then stationnumber=551
      if number01=12 then stationnumber=245
      if number01=13 then stationnumber=233
      if number01=14 then stationnumber=550
      if number01=15 then stationnumber=549
      if number01=16 then stationnumber=334
      if number01=17 then stationnumber=72
      if number01=18 then stationnumber=546
      if number01=19 then stationnumber=547
      if number01=20 then stationnumber=548
      if number01=21 then stationnumber=91
      if number01=22 then stationnumber=545
      if number01=23 then stationnumber=555
      if number01=24 then stationnumber=541
      if number01=25 then stationnumber=207
      if number01=26 then stationnumber=506
      if number01=27 then stationnumber=526
      if number01=28 then stationnumber=554
      if number01=29 then stationnumber=553
      if number01=30 then stationnumber=220
      if number01=31 then stationnumber=290
      if number01=32 then stationnumber=313
      if number01=33 then stationnumber=360
      if number01=34 then stationnumber=556
      if number01=35 then stationnumber=344
      if number01=36 then stationnumber=372
      if number01=37 then stationnumber=391
      if number01=38 then stationnumber=409
      if number01=39 then stationnumber=461
      if number01=40 then stationnumber=447
      if number01=41 then stationnumber=557
      if number01=42 then stationnumber=558
      if number01=43 then stationnumber=424
      if number01=44 then stationnumber=559
      if number01=45 then stationnumber=483
      terminal=1
      call cleartext
      call command01
      call selectstation
    end sub
    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    You are on the right track. Once you start to read the book on using resources and dialogs, you'll be away laughing... and on your way to understanding yet another layer of Microsoft Windows.

    In the mean time, take a look at the example files that use resource files to display dialogs - they show the general technique quite clearly.



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

    Leave a comment:


  • Jeffrey Morris
    replied
    Lance, I loaded the NYCTA01.DLG file into NotePad, added #include "resource.h" to the file, saved the file as NYCTA01.RC, copied the RESOURCE.H file to the same directory as the NYCTA01.RC and RC.EXE files, and used RC to compile the file into NYCTA01.RES file. I used PBRES to convert the NYCTA01.RES file into NYCTA01.PBR file. I didn't know why the Dialog Editor creates *.RES files that are not compatible with PBRES. In the NYCTA01.BAS file, I added #resource "nycta01.pbr" but I am confused as to writing code for the dialog box. How can I write code for the dialog box? I ordered "WIN32 Programming" book. Jeffrey.

    ------------------

    Leave a comment:


  • jcfuller
    replied
    Lance,
    Actually, it is DLGEDIT.EXE that produces "incompatible" (for lack of a better word) .RES binary files - it apparently uses it's own binary format.
    To be a bit more speficic the DLGEDIT.EXE that ships with PB/DLL is a 16bit application and as such produces 16bit res files.


    Again if you are doing any serious programming with PB/DLL then do yourself a favor and
    invest $26.95 for BC++ 5.02 from:
    www.mcp.com/catalog/corp_bud.cfm?isbn=1575953021
    James



    [This message has been edited by jcfuller (edited April 07, 2000).]

    Leave a comment:


  • Lance Edmonds
    replied
    Actually, it is DLGEDIT.EXE that produces "incompatible" (for lack of a better word) .RES binary files - it apparently uses it's own binary format.

    The PowerBASIC PBRES.EXE utility can take a 'proper' .RES files from any standard resource editor (Visual Studio, Resource Workshop, etc) and produce a .PBR file ready for linking into the app at compile time. Because the .RES files created with DLGEDIT are not compatible with this process, these .RES files are the exception rather than the rule.

    In general terms, a .PBR file is formatted so that it can be linked without further reformtting. We've had a few requests to allow the compiler to link (real) .RES files directly but I do not know if/when such requests will be implemented.


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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Hello...

    I was just thinking about this whole issue here and I found myself wondering why PowerBasic decided to create there own resource file format rather that using what the dialog editor creates?

    Cheers!

    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    To be accurate, you don't use the .RES file created by DLGEDIT, however a different .RES is generated by RC.EXE and this one is required in order to create a .PBR file. The .RES file created with DLGEDIT.EXE is not compatible with the .RES format required by PBRES.EXE to make a .PBR file.

    As pointed out, there are documents in the FAQ forum that will help you converting a .DLG through to a .PBR file.

    Clear as mud?

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

    Leave a comment:


  • Scott Hauser
    replied
    Hi Again
    Sorry about misspelling your name.

    I forgot to mention that you don't actually use the res file.
    Scott

    ------------------

    Leave a comment:


  • Scott Hauser
    replied
    hi jeffery,

    you must make a few changes to the nycta01.dlg file before you can use it.



    hope this helps


    ------------------

    Leave a comment:


  • Jeffrey Morris
    started a topic Dialog boxes

    Dialog boxes

    I used Dialog Editor to create a dialog box. The program created NYCTA01.DLG and NYCTA01.RES files. I tried to use RC and PBRES programs but RC expected NYCTA01.RC file and BPRES expected NYCTA01.BAS file. How can I use NYCTA01.RES in my program? Jeffrey.
Working...
X