1. wxEuphoria - set_back_color()

If in the 2nd last line, you change color2 to color1, a bug happens.
You get black.
Is this a bug in my program? Or in wxEuphoria?

constant PROGRAM_TITLE = "set_back_color() bug"

without warning
include wxEuphoria.e
include wxSizer.e
include wxText.e
include wxButton.e
include wxCheckBox.e
include wxGraphics.e

constant
 frameWin = create(wxFrame,{0,-1,PROGRAM_TITLE,-1,-1,300,300}),
 Win = create(wxPanel,{frameWin}),
 boxWin = create(wxBoxSizer,{wxVERTICAL})
set_sizer(Win,boxWin)

constant
 color1 = create(wxColour,{255,120,120}),
 color2 = create(wxColour,{255,0,255}),
 pnl1 = create(wxPanel,{Win}),
 pnl2 = create(wxPanel,{Win}),
 box1 = create(wxBoxSizer,{wxVERTICAL}),
 box2 = create(wxBoxSizer,{wxVERTICAL}),
 lbl1 = create(wxStaticText,{pnl1,-1,"panel 1"}),
 lbl2 = create(wxStaticText,{pnl2,-1,"panel 2"}),
 chkColor = create(wxCheckBox,{Win,-1,"Color"}),
 btnColor = create(wxButton,{Win,-1,"Change Color"})

set_sizer(pnl1,box1)
set_sizer(pnl2,box2)
add_sizer_to_sizer(boxWin,box1,1,wxGROW,0)
add_sizer_to_sizer(boxWin,box2,1,wxGROW,0)
add_window_to_sizer(box1,pnl1,1,wxGROW,0)
add_window_to_sizer(box2,pnl2,1,wxGROW,0)
add_window_to_sizer(boxWin,chkColor,0,wxGROW,0)
add_window_to_sizer(boxWin,btnColor,0,wxGROW,0)
----------------------------
procedure onClick_chkColor(atom this,atom event_type,atom id,atom event)
  if get_checked(chkColor) then
    set_back_color(pnl1,color1)
    set_back_color(pnl2,color1)
  else
    set_back_color(pnl1,color2)
    set_back_color(pnl2,color2)
  end if
  refresh_window(pnl1)
  refresh_window(pnl2)
end procedure
set_event_handler({frameWin,chkColor},get_id(chkColor),
 wxEVT_COMMAND_CHECKBOX_CLICKED,routine_id("onClick_chkColor"))
----------------------------
procedure onClick_btnColor(atom this,atom event_type,atom id,atom event)
  if get_checked(chkColor) then
    set_checked(chkColor,0)
    set_back_color(pnl1,color2)
    set_back_color(pnl2,color2)
  else
    set_checked(chkColor,1)
    set_back_color(pnl1,color1)
    set_back_color(pnl2,color1)
  end if
  refresh_window(pnl1)
  refresh_window(pnl2)
end procedure
set_event_handler({frameWin,btnColor},get_id(btnColor),
 wxEVT_COMMAND_BUTTON_CLICKED,routine_id("onClick_btnColor"))
----------------------------
set_back_color(pnl1,color1)
set_back_color(pnl2,color2)  -- Change this to color1 and a bug happens.
wxMain(frameWin)


new topic     » topic index » view message » categorize

2. Re: wxEuphoria - set_back_color()

Jerry Story wrote:
> 
> If in the 2nd last line, you change color2 to color1, a bug happens.
> You get black.
> Is this a bug in my program? Or in wxEuphoria?
> 

It's not your code (although I think this is what your sizer code 
should look like:

add_window_to_sizer(boxWin,pnl1,1,wxGROW,0)
add_window_to_sizer(boxWin,pnl2,1,wxGROW,0)

add_window_to_sizer(boxWin,chkColor,0,wxGROW,0)
add_window_to_sizer(boxWin,btnColor,0,wxGROW,0)


It works properly under windows, but not linux.  I don't know if the bug
is in wxWidgets or some other weird GTK behavior.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. wxEuphoria - set_back_color()

Bug report -- wxEuphoria - set_back_color() - Linux:

set_back_color() works correctly on the main wxPanel and on wxListBox.

Doesn't work on wxButton's.

Sometimes works correctly on child wxPanel's, sometimes makes them black instead
of the correct color.
With 2 of them, sometimes one will work correctly and not the other.
I did not observe any rule of behavior.

It doesn't work directly on wxStaticText's, but when applied to the main wxPanel
it works on all of them at the same time.

new topic     » goto parent     » topic index » view message » categorize

4. Re: wxEuphoria - set_back_color()

Jerry Story wrote:
> 
> Sometimes works correctly on child wxPanel's, sometimes makes them black
> instead of the correct color.
> With 2 of them, sometimes one will work correctly and not the other.

What I mean here is when I try to change the color.
Just setting the color and leaving it works okay.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu