Announcement

Collapse
No announcement yet.

Text caption in DDT frame control has line thru it

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

  • Text caption in DDT frame control has line thru it

    In my DDT frame control, the caption for the frame shows the line running through it. Is this normal behavior and something that I should be dealing with in the paint event?

    The code im using to create the frame is basically:

    CONTROL ADD FRAME, g_hMain, %ctlFrame1, "Test",x,y,xx,yy,0,%WS_EX_TRANSPARENT

    -Mike

  • #2
    Mike --
    Normally a frame looks so
    Code:
       #Compile Exe
       #Dim All
       #Register None
       #Include "Win32Api.Inc"
    
       CallBack Function DlgProc
          Select Case CbMsg
             Case %WM_INITDIALOG
                Control Add Frame,   CbHndl, 101, " Inside (drive/directory) ", 5, 5, 240, 27
                Control Add TextBox, CbHndl, 102, "", 10, 15, 210, 12
                Control Add Button,  CbHndl, 103, "...", 225, 15, 15, 12
                Control Add Frame,   CbHndl, 104, " Application folder ", 5, 35, 120, 27
                Control Add TextBox, CbHndl, 105, "MyApp", 10, 45, 110, 12
                Control Add Button,  CbHndl, 106, "&Install", 140, 43, 50, 16, %BS_DEFAULT
                Control Add Button,  CbHndl, 107, "&Cancel", 195, 43, 50, 16
          End Select
       End Function
    
       Function PbMain
          Local hDlgMain As Long
          Dialog New %HWND_DESKTOP, "Setup", , , 250, 70, %WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX To hDlgMain
          Dialog Show Modal hDlgMain Call DlgProc
       End Function
    [This message has been edited by Semen Matusovski (edited May 21, 2000).]

    Comment


    • #3
      Semen, your code prompts me to make a few comments... (disclaimer: I'm not
      at my DEV PC to test your code, but my comments are based on general observation)

      1. To center your dialog, add the %DS_CENTER style to the DIALOG NEW statement.
      The centering code in your example does not take the size and location of the
      taskbar into account (off hand, I'm not sure if %DS_CENTER takes this into account,
      but at the least it should duplicate the effect of your code).

      2. You can specify the client size of the dialog in the DIALOG NEW statement,
      explicitly add a %WS_CAPTION style the DIALOG NEW statement.

      By using these tips, you can reduce the amount of code your application requires,
      hence there should be les things to go wrong/debug.

      The original question shows that the frame control is using a "transparent" style,
      so it implies that the frame is either being drawn incorrectly with this style, or
      that it is appearing over the top of another control. We'd need to see more of the
      code to be 100% sure. OTOH, I've never used a transparent style with a FRAME control
      so when I get back to my DEV PC, I'll try it out.

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

      Comment


      • #4
        Lance --
        1) About window/client size of dialog.
        You are right, thank you very much for this tip. You should add it to FAQ.
        BTW, I can't understand, why DDT engine with single %WS_SYSMENU sets window size instead of client.
        2) I tested WS_EX_TRANSPARENT. No any effect (Win2000), so can't be a reason of a problem.

        PS. I inserted If (GetWindowLong(hDlg, %GWL_STYLE) And %WS_CAPTION) Then MsgBox "Ok" after Dialog New 0, ..., 100, %WS_SYSMENU Or %WS_MINIMIZEBOX To hDlg
        Like expected, created window has %WS_CAPTION. So, it's DDT specific.



        [This message has been edited by Semen Matusovski (edited May 22, 2000).]

        Comment


        • #5
          I found the problem. Basically, I have a label on my dialog which i need to have a transparent background so I use

          CASE %WM_CTLCOLORSTATIC
          SetBkMode CBWPARAM, %TRANSPARENT
          SetTextColor CBWPARAM, %BLACK
          FUNCTION = GetStockObject(%NULL_BRUSH)

          With the addition of a Frame, it seems that the caption of the frame acts just like a transparent label and so you can see the line from the rest of the Frame passing through the text instead of being hidden behind the label.

          I'm not sure what the best way to handle this would be. If you take the SMTP.BAS sample in the C:\PBDLL60\Samples\Tcp folder and add the following line after the rest of the CONTROL ADD's..

          CONTROL ADD FRAME, hDlgMain, 200, "Test" , 100, 230, 90, 15, 0, 0

          You wind up with a a transparent caption, but with a line running through it. If you make it so the frame is not transparent, then the bitmap doesnt show through.

          -Mike

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


          [This message has been edited by Mike Joseph (edited May 22, 2000).]

          Comment


          • #6
            I'm getting quite good at DDT!

            Semen, as I noted, you have to *explicitly* add %WS_CAPTION - it is by design so make it easer for you to choose whether you are specifying client or window dimensions depending on the dialog styles you use.

            I agree that this useful tip needs to be in the doc's and I'll make sure this (and all of the other useful tips that have come to light) are added in too. Actually, this particular one was discussed when PB/DLL 6.0 was first released.

            If anyone has any other tips you think would be useful for the doc's, whether they be for DDT or otherwise, please post them into a new thread.

            I'm only looking for specific suggestions and tips for the documentation at this time. Also, any bugs in the doc's that are not covered in the errata (already in the FAQ forum) are of interest too.

            Thanks!


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

            Comment

            Working...
            X