Re: Nicola Question about TOPMOST WINDOW

Started by Zlatko Vid, December 08, 2020, 04:00:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zlatko Vid

And another
it is for Icon Button:

INT button1, b1ID = 100 : % ICONBUTTON = 1409351744
button1 = SetButton(win,10,2,48,48,"", ICONBUTTON, 0,b1ID)
INT icon1 = LoadImage(0, "micData\icOpen.ico", 1, 32, 32, 24) 'load icon...
SendMessage( button1, 247, 1, icon1)                        'add icon to button...


Also another way is to use button as parent and add listbox control as child to that button then color listbox.
like this :


CASE WM_CTLCOLORLISTBOX
LBhdc = getDC(LBox)
If theme = 3 ' default
   INT lbColor = CreateSolidBrush(RGB(255,255,255))
   'SetBkMode(LBhdc,1)
   SetBkColor( wparam, RGB(255,255,255))
   SetTextColor( wparam,RGB(20,45,125))
   'InvalidateRect(Lbox, 1, 0)
   return lbColor
End if

Zlatko Vid

Yes using Icon Button is a easiest way to made your own button without
messing up with whole bunch of DC functions
look on image :


Zlatko Vid

QuoteI have seen that in other basic language dialects the command is explicitly present.
So, it seems very strange to me that O2 is not there.

That is not true , i know only one basic dialect which have such a command and his name is Ionic Wind Basic ( former EBAsic)
command is SETCONTROLCOLOR which use built.in DC functions .

Zlatko Vid

By the way there is WM_CTLCOLORBTN message

    WPARAM wParam;
    LPARAM lParam;

Zlatko Vid

here is code how you can create colored button in winApi
it is simple but can be better using new registered class for button

Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
win = hwnd
SELECT hwnd
CASE win
Select wmsg


CASE WM_CTLCOLORBTN
      btDC = GetDC(button0)
      int btColor = CreateSolidBrush(RGB(220,0,0))
       ' SetBkMode(btdc,1)
        SetBkColor (btdc,rgb(0,0,225))
        SetTextColor(btdc,RGB(240,220,125))
        TextOut btdc,16,8, " COLOR ", 7
  return btColor


CASE WM_CREATE
     button0 = SetButton(win,180,10,100,32,"RED", 0x50000001 | &hb,0x200,b0ID) '0x50001000 |