Re: dgui - Button continually repainting

2014-09-15 Thread Mike James via Digitalmars-d-learn

Hi Andre,

I've found a solution to the repainting problem. If you tick the 
Disable visual themes in the compatibility tab of the program 
properties (associated with the program icon) the button is only 
repainted when the mouse cursor enters and exits the button area.


Regards, -=mike=-

On Wednesday, 10 September 2014 at 19:46:06 UTC, andre wrote:

Hi,
Just noticed there is an event drawItem whichs is called on 
WM_DRAWITEM. Class core.controls.ownerdrawcontrol.d is very 
interesting.

This event seems more suitable.

Kind regards
André


On Wednesday, 10 September 2014 at 07:19:53 UTC, Mike James 
wrote:

//
Please file this issue also on the dgui

bibucket home page.

Kind regards
Andre


//

Done.

Regards, -=mike=-




Re: dgui - Button continually repainting

2014-09-10 Thread Mike James via Digitalmars-d-learn

//
Please file this issue also on the dgui

bibucket home page.

Kind regards
Andre


//

Done.

Regards, -=mike=-


dgui - Button continually repainting

2014-09-09 Thread Mike James via Digitalmars-d-learn

Hi.

I've created a graphic button as per this example on the dgui 
website:


import dgui.all;

class MyForm: Form
{
this()
{
text = An Exception was thrown...;
size = Size(130, 100);

// Or use `Bitmap.fromFile`:
auto img = new Bitmap(90, 15, SystemColors.yellow);
auto pen = SystemPens.blackPen;

with(new Button())
{
bounds = Rect(10, 10, 100, 25);
parent = this;
paint.attach((s, e)
{
e.canvas.drawImage(img, 5, 5);
e.canvas.drawLine(pen, 5, 10, 95, 10);
e.canvas.drawLine(pen, 10, 5, 10, 20);
});
}
}
}

int main()
{
return Application.run(new MyForm());
}

and added a writeln(paint) in the paint.attach to show when the 
button is repainting. When the form with the button is visible 
the button is being continually repainted. Is this a 'feature' of 
dgui or is there a flag to set to only re-paint when the button 
is invalidated?


Regards, -=mike=-.


Re: dgui - Button continually repainting

2014-09-09 Thread andre via Digitalmars-d-learn

Hi,

Just checked, on WM_PAINT all event listeners (event paint) are 
called.


Overwriting onPaint seems to work better (issue 18 in dgui 
bitbucket site). Please file this issue also on the dgui bibucket 
home page.


Kind regards
Andre


On Tuesday, 9 September 2014 at 10:50:11 UTC, Mike James wrote:

Hi.

I've created a graphic button as per this example on the dgui 
website:


import dgui.all;

class MyForm: Form
{
this()
{
text = An Exception was thrown...;
size = Size(130, 100);

// Or use `Bitmap.fromFile`:
auto img = new Bitmap(90, 15, SystemColors.yellow);
auto pen = SystemPens.blackPen;

with(new Button())
{
bounds = Rect(10, 10, 100, 25);
parent = this;
paint.attach((s, e)
{
e.canvas.drawImage(img, 5, 5);
e.canvas.drawLine(pen, 5, 10, 95, 10);
e.canvas.drawLine(pen, 10, 5, 10, 20);
});
}
}
}

int main()
{
return Application.run(new MyForm());
}

and added a writeln(paint) in the paint.attach to show when 
the button is repainting. When the form with the button is 
visible the button is being continually repainted. Is this a 
'feature' of dgui or is there a flag to set to only re-paint 
when the button is invalidated?


Regards, -=mike=-.




dgui - self defined components with double buffering

2014-09-09 Thread andre via Digitalmars-d-learn

Hi,
I habe several self defined components in my Windows.
During resizing of the Windows, the Windows controls
gets ugly and then disappear. I want to implement
double buffering but found no obvious way to create
a memory canvas and after having done the drawing copying
It to the canvas of the control.

Current implementation looks this:

class TitleBox : PictureBox
{
private Color startColor_ = SystemColors.darkGray;
private Color endColor_ = SystemColors.white;

protected override void onPaint(PaintEventArgs e)
{
   Canvas c = e.canvas;
   c.fillRectGradient(Rect(nullPoint, this.size), 
startColor_, endColor_, GradientFillRectMode.vertical);

   c.drawText(text, Rect(Point(2,2), this.size));

   super.onPaint(e);
}
}

Does anyone have an idea?

Kind regards
André


DGUI: Using scroll bars

2014-03-25 Thread Mike James
I'm using DGUI (the one on bitbucket) and I can't work out how to 
use the scrollbars. I've got them enabled but I can't work out 
from the library files how to set the scale and read the 
position. Also is there a way of turning off the vertical 
scrollbar - the 'enable' turns them both on.


Any help would be appreciated...

regards,

-=mike=-


Re: DGUI

2014-02-16 Thread evilrat
On Saturday, 15 February 2014 at 16:26:28 UTC, Josh Phillips 
wrote:
On Friday, 14 February 2014 at 20:36:42 UTC, Jeremy DeHaan 
wrote:
Unless I am mistaken, it looks like the last time it was 
updated was in 2011. You'd probably have to update a bunch of 
stuff in the sources in order to get it to work properly.


I would recommend gtkD as a gui library.


I think you are mistaken. On bitbucket there are updates in 
october last year. Also I have heard lots of bad things about 
Gtk on windows.


and on OS X it is segfaults often, so gtk is no go for non linux


Re: DGUI

2014-02-16 Thread Rikki Cattermole

On Friday, 14 February 2014 at 20:29:50 UTC, Josh Phillips wrote:
I recently downloaded and tried to use DGUI but I can't get it 
to work. Is there any tutorials on how to build an use it? Or 
can anyone help me and tel me a way on how I can get it to work?


I know this isn't really related to DGUI but, I think this will 
be useful.
I have some semi old static bindings for IUP [0]. Very stable api 
IUP [1] has (c library) and has good cross platform functionality.

Little limited, but will definitely work in almost any cases.

[0] 
https://bitbucket.org/alphaglosined/libglosined/src/85ab6b2135879848e7efd5f1dfa732f2cfb753f8/iup/?at=default

[1] http://www.tecgraf.puc-rio.br/iup/


Re: DGUI

2014-02-15 Thread Josh Phillips

On Friday, 14 February 2014 at 20:36:42 UTC, Jeremy DeHaan wrote:
Unless I am mistaken, it looks like the last time it was 
updated was in 2011. You'd probably have to update a bunch of 
stuff in the sources in order to get it to work properly.


I would recommend gtkD as a gui library.


I think you are mistaken. On bitbucket there are updates in 
october last year. Also I have heard lots of bad things about Gtk 
on windows.


DGUI

2014-02-14 Thread Josh Phillips
I recently downloaded and tried to use DGUI but I can't get it to 
work. Is there any tutorials on how to build an use it? Or can 
anyone help me and tel me a way on how I can get it to work?


Re: DGUI

2014-02-14 Thread Jeremy DeHaan

On Friday, 14 February 2014 at 20:29:50 UTC, Josh Phillips wrote:
I recently downloaded and tried to use DGUI but I can't get it 
to work. Is there any tutorials on how to build an use it? Or 
can anyone help me and tel me a way on how I can get it to work?


Unless I am mistaken, it looks like the last time it was updated 
was in 2011. You'd probably have to update a bunch of stuff in 
the sources in order to get it to work properly.


I would recommend gtkD as a gui library.