Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Flat Buttons

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

  • Flat Buttons

    I tried to make the CONTROL button's appear flat (w/o
    raised 3-D look). But the button disapears. Does anyone
    see what I'm doing wrong?
    -----------------------------------------------------------
    Code:
    #COMPILE EXE
    #REGISTER NONE
    $INCLUDE "WIN32API.INC"
    
    GLOBAL hDlg AS LONG
    
    GLOBAL DWidth AS LONG, DHeight AS LONG
    GLOBAL KWidth AS LONG, KHeight AS LONG
    
    CALLBACK FUNCTION CB_KEY()
    MSGBOX"aaa"
    END FUNCTION
    
    FUNCTION PBMAIN() AS LONG
    DWidth=600:DHeight=440
    KWidth=10:KHeight=100
    
    DIALOG NEW 0,"Academy",,,DWidth,DHeight,%WS_CAPTION OR %WS_SYSMENU,0 TO hDlg
    IF hDlg=0 THEN EXIT FUNCTION  ' Error occurred
    t&=(DWidth-52*(KWidth+1))/2
    FOR i&=0 TO 51
      CONTROL ADD BUTTON,hDlg,800+i&,"",t&+(KWidth+1)*i&,260,KWidth,KHeight,0,%BS_OWNERDRAW OR %BS_DEFAULT OR %BS_LEFT CALL OR %BS_FLAT CB_KEY
    ' The statement below works but causes a 3D raised look
    ' CONTROL ADD BUTTON,hDlg,800+i&,"",t&+(KWidth+1)*i&,260,KWidth,KHeight,0,%BS_OWNERDRAW OR %BS_DEFAULT OR %BS_LEFT CALL CB_KEY
    NEXT i&
    DIALOG SHOW MODAL hDlg
    END FUNCTION

  • #2
    Originally posted by Joe Speroni:
    I tried to make the CONTROL button's appear flat (w/o
    raised 3-D look). But the button disapears. Does anyone
    see what I'm doing wrong?
    Joe --
    Many.
    1) %BS_OWNERDRAW means that you draw by yourself.
    2) You set exstyle instead of style
    Sample of "flat":
    Code:
       #Compile Exe
       #Register None
       #Dim All
       #Include "WIN32API.INC"
       Function PbMain() As Long
          Dim hDlg As Long
          Dialog New 0,"Academy", , , 100, 70, %WS_SYSMENU To hDlg
          Control Add Button,hDlg, 101,"3D", 10, 5, 75, 15
          Control Add Button,hDlg, 102,"Flat", 10, 25, 75, 15, %BS_FLAT
          Dialog Show Modal hDlg
       End Function
    ------------------

    Comment


    • #3
      Thanks again Semen. The problem with the extra zero in the
      CONTROL ADD line would have taken me a lot of time to find!
      Didn't realize I was using EX_ styles.

      %BS_FLAT is 0x8000. I was unable to find any %WS_EX_xxxx
      definition with the same value. So I don't know what it was
      doing, but it acted as if it meant "don't display anything".

      The OWNERDRAW code was intended, but I didn't include the CB
      code.

      Thanks for your EX clue. I got it the code working.

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

      Comment

      Working...
      X