Author Topic: Can a Button Have non-default BackColor  (Read 20697 times)

0 Members and 1 Guest are viewing this topic.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Can a Button Have non-default BackColor
« on: September 18, 2018, 07:20:36 am »
@Fellippe, I have tries to give a Button a different BackColor.  The color slider works (as for other controls), but the Button itself does not change colour, either in the UI view or at run time.  Am I doing something stupid?

Incidentally, is there a place in the .bas to put code that executes once at run start, but after the form has been loaded (and not associated with any control)?  I placed the following in the  __UI_OnLoad subroutine and the program sticks at 'Initialising'.

Code: QB64: [Select]
  1. WHILE NOT CorrectButton`
  2.             _LIMIT 60
  3.             'Assumes hardware has mouse buttons, value <=5
  4.             IF _MOUSEINPUT THEN
  5.                 CorrectButton` = False: ButtonNo1%% = 1
  6.                 WHILE NOT CorrectButton` AND ButtonNo1%% <= 5
  7.                     IF _MOUSEBUTTON(ButtonNo1%%) THEN
  8.                         CorrectButton` = True
  9.                     ELSE
  10.                         ButtonNo1%% = ButtonNo1%% + 1
  11.                     END IF
  12.                 WEND
  13.             END IF
  14.             __UI_DoEvents
  15.         WEND

Richard (still learning, but slowly!)
* QB64Mahjong.frm (Filesize: 3.67 KB, Downloads: 367)

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Can a Button Have non-default BackColor
« Reply #1 on: September 18, 2018, 11:03:10 am »
Incidentally, is there a place in the .bas to put code that executes once at run start, but after the form has been loaded (and not associated with any control)?  I placed the following in the  __UI_OnLoad subroutine and the program sticks at 'Initialising'.

Forget that part, I've decided to attach that routine to a Button.  It now works OK, of course.
Richard