Page 1 of 1

Posted: Mon Sep 02, 2002 7:31 pm
by BackupUser
Restored from previous forum. Originally posted by pantera.

About the 2DDrawing.pb example.
If I move the window outside the visible area of the screen
and back again, the graphics are cut and will never repaint.
It doesn't mather what window event i add either. It still
won't repaint.

Is this a bug or is the reference manual, not to be to
harsh, just incomplete?

'Cause when i've read through this forum i've encountered
things like "FindWindow_","SetWindowPos_","GetSystemMetrics_",
"#SM_CXSCREEN". And of course, the terms does not exist in the
reference manual.

Posted: Mon Sep 02, 2002 9:35 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> If I move the window outside the visible area of the screen
> and back again, the graphics are cut and will never repaint.
> Is this a bug?

I think so (Fred?). In any case, I posted a (crappy) workaround at
this page if you want to take a look (and probably enhance):

viewtopic.php?t=1648

The other way to do it, which may be better, is to draw the graphics
on an ImageGadget, which doesn't get destroyed after moving offscreen.

> 'Cause when i've read through this forum i've encountered
> things like "FindWindow_","SetWindowPos_","GetSystemMetrics_",
> "#SM_CXSCREEN". And of course, the terms does not exist in the
> reference manual.

Items starting with a hash ("#") are called constants and they are
similar to variables except their value never changes during runtime.

Any command ending with an underscore ("_") is not a PureBasic command,
but a Windows API command. There are hundreds of these and PureBasic
supports them all. See this post for more information on using them:

viewtopic.php?t=736


PB - Registered PureBasic Coder

Posted: Tue Sep 03, 2002 1:07 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.

Hello,

I do not consider it is a bug on my own, but just you have to use a callback procedure to support events.

Using an ImageGadget, PB, may solve partly such question, but you will not be able to draw dynamically.

If you have to draw dynamically, using a callback enables to manage events corresponding to 'destroyed content', 'window move' or 'window resize'.

Just start in looking Image.pb source example.

I will then provide some advanced callback example if you need.

Rgrds

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Tue Sep 03, 2002 1:17 pm
by BackupUser
Restored from previous forum. Originally posted by pantera.

ok, thank you. But there must be some otherway to it, other than
polling the windows position every now and then. Like making
the window invalid somehow.



I'll better check the image.pb code for some callbacks.


The "#" constants still have to be defined somewhere in pb, even
if they are a part of some api...

Posted: Tue Sep 03, 2002 1:23 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> you have to use a callback procedure to support events.

But shouldn't the PB_EventRepaint command trigger when the window needs
repainting after a WindowEvent()? That's what the docs say... yet it
doesn't do it, so it's a bug as far as I'm concerned. There's nothing
in the docs for WindowEvent() that says you have to use a callback with
PB_EventRepaint...


PB - Registered PureBasic Coder

Posted: Tue Sep 03, 2002 1:27 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> The "#" constants still have to be defined somewhere in pb, even
> if they are a part of some api...

They are in the "Windows.res" file in the "Residents" folder of PureBasic.
However, if you simply just want to know what they all are and what
they do, then download the following file (written for Visual Basic
by Microsoft, but applies to PureBasic and C++ just as well):

http://www.mvps.org/vb/code/Win32api.zip


PB - Registered PureBasic Coder

Posted: Tue Sep 03, 2002 3:47 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
Originally posted by PB
Any command ending with an underscore ("_") is not a PureBasic command, but a Windows API command.
There are hundreds of these and PureBasic supports them all.

PB - Registered PureBasic Coder
NOPE!
example:
SHEmptyRecycleBin_() ; or SHEmptyRecycleBinA_()




Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Posted: Tue Sep 03, 2002 9:06 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> > There are hundreds of these and PureBasic supports them all.
>
> NOPE!
> example:
> SHEmptyRecycleBin_() ; or SHEmptyRecycleBinA_()

Okay, I should have said "supports most of them" up there. :)


PB - Registered PureBasic Coder

Posted: Wed Sep 04, 2002 4:44 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

> SHEmptyRecycleBin_() ; or SHEmptyRecycleBinA_()

Its the same.
For some WinAPI functions that work with strings,
there are 2 versions available.
One has an ending "A" and it stands for ASCII -
and the other has an ending "W" - which stands
for UniCode.

PureBasic doesnt support UniCode strings internally,
so all API functions use the A-version only.

Its the same in C:
You dont use "SHEmptyRecycleBinA" directly in your
code... you simply use "SHEmptyRecycleBin" without
the special ending char.
And in the corresponding header file ( ShellAPI.h )
you can find the lines...

;---
#ifdef UNICODE
#define SHEmptyRecycleBin SHEmptyRecycleBinW
#else
#define SHEmptyRecycleBin SHEmptyRecycleBinA
#endif // !UNICODE
;---

...which say that the name is only "SHEmptyRecycleBin".
Which function ( A or W ) is used for compiling, is
automatically detected by the compiler - it depends
if you make an UniCode program or not.

So PureBasic is very correct at this thing.

cya,
...Danilo

(registered PureBasic user)

Posted: Wed Sep 04, 2002 5:59 am
by BackupUser
Restored from previous forum. Originally posted by Franco.

The only thing I wanted to mention is that "SHEmptyRecycleBin" is not known by PureBasic itself.
You can use it through the OpenDLL/CallFunction commands instead of simply say: SHEmptyRecycleBin_(bla,bla,bla)
And there are other commands that are not automatically known by PureBasic.

Anyway - more important is that I'm going to bed now - tschuess - :)

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.