Page 1 of 1

ClearScreen(RGB); BackColor(RGB); FrontColor(RGB) a.s.f....

Posted: Sun Apr 02, 2006 3:24 pm
by Peter_DK
Hi guys...

I've just started to work with PureBasic. I must say, that I'm totally excited about this excellent programming package. The potiential
is simply put - Awesome!

Still... Even though the language is perfectly understandable and easy
to implement, there's something that eludes me....

Example:

Imagine, that you have created three windows with the OpenWindow()
function and wish to work on these three simultaniously. How do you
use the simple commands such as ClearScreen, BackColor and FrontColor
on each window? Normally I would, through API use the Window's handle to tell each command, which window they should process. The three commands do not, according to the help file allow handle to a window or am I looking at this the wrong way?


Hope someone can enlighten me on this issue.

Concerning the ClearScreen(RGB)... Why do you need to assign a color?
Why not simply ClearScreen()?


Thanks in advance.

Best regards

Peter.

Re: ClearScreen(RGB); BackColor(RGB); FrontColor(RGB) a.s.f.

Posted: Mon Apr 03, 2006 12:02 pm
by Comtois
Peter_DK wrote:Imagine, that you have created three windows with the OpenWindow() function and wish to work on these three simultaniously. How do you use the simple commands such as ClearScreen, BackColor and FrontColor on each window?
doc say
Note: Only one windowed screen can be opened at one time.
May be i'm wrong , and you dont need windowed screen ?

ClearScreen(RGB); BackColor(RGB); FrontColor(RGB) a.s.f....

Posted: Mon Apr 03, 2006 3:31 pm
by Peter_DK
Hey Comtois.

Thank you for answering me.

Opening several windows/screens pose no problem.
Only being able to work in a single window would
in some ways degrade the usage/possibilities of purebasic.

Since the commands do not take an extra wHnd (Window handle)
parameter, I suppose, that there are a way direct the PB commands
to a specific window opened with the OpenWindow().

I can manipulate the windows using API, but it would be nice if
this could be done using PB's internal instruction set too.

Anyway...I'm still reading so... Hopefully I'll find the solution:)

Best regards

Peter.

Posted: Mon Apr 03, 2006 4:15 pm
by Fred
If you're using PB 3.94, you probably want to use UseWindow() to change the current window. To know on which window an event has occured, you have to use EventWindowID().

ClearScreen(RGB); BackColor(RGB); FrontColor(RGB) a.s.f....

Posted: Mon Apr 03, 2006 4:46 pm
by Peter_DK
Hi Fred.

I've jumped straight into your betas. Lots of great features implemented. (Beta 8).. Just downloaded Beta 9... :)

The WindowOutput(#Window) , EventWindow() , WindowEvent() and
SetWindowCallback(@ProcName,[ID]) seems the way to, when you need
to determine and process events received from a specific window.

However, even though I do understand the usage of the window functions
you've implemented, the procedures to manipulate the windows still eludes me, when the internal instruction set doesn't have the Windows Handle parameter.

Is it possible to direct PB's internal instructions to a specific window or
am I forced to manipulate the windows by API?


TIA

Peter.

Posted: Mon Apr 03, 2006 5:01 pm
by Fred
I have to admit i don't understand what you want to do exactly. If you want to get the window handle use WindowID(). To handle the events on the Windows, use WaitWindowEvent() and then do a 'Select' to parse the events (look in the examples). If you want to handle all the WinAPI events, you will have to install your callback.

ClearScreen(RGB); BackColor(RGB); FrontColor(RGB) a.s.f....

Posted: Mon Apr 03, 2006 5:32 pm
by Peter_DK
Hi again fred.

Yeah...I do understand, that you don't get my question, since my
explanation was pretty vague.

I'm trying to work with three windows. (Stock exchange).

Window 1: Stockbrokers, Companies, General info.
Window 2: Updates the stock exchange for a specific company
chosen from Window 1.
Window 2 will be clean window.(No gadgets) text only.

Window 3: Stock exchange (buy/sell) user input.

It started out as a simple test, but became extremely complexed.
Problem arose when I got data from Window 1 and should process
the data in Window 2.

The above three functions:
To direct ClearScreen(), BackColor() and FrontColor() to window 2
is ehmmm not clear to me...

To put it in plain english: Unless there is another method, which I
assume there is, following would have been nice: ClearScreen(wHnd)
BackColor(wHnd,RGB(0,0,0)), FrontColor(wHnd, RGB(255,255,255))


Best regards

Peter.

Posted: Mon Apr 03, 2006 5:45 pm
by Fred
You try to mix several things. ClearScreen() is only for the sprite and multimedia stuffs. You probably don't want that, better use an image instead and display it trough an ImageGadget(). This way you can do StartDrawing(ImageOutput(x)) etc.

Posted: Mon Apr 03, 2006 5:53 pm
by Peter_DK
Hi again Fred... :)

StartDrawing(ImageOutput(x)): StopDrawing()

I see your point.

Things makes a whole lot more sense now.

I've been going out of my mind about this!!
So hard to see and yet such a simple solution!

Thank you very,very,very,very,very,very much


I'll let you get back to work now ;).

Have an excellent evening

Posted: Mon Apr 03, 2006 7:52 pm
by kenmo
Why not use text/string/etc gadgets? No images, screens, or drawing procedures required.

Posted: Tue Apr 04, 2006 4:42 pm
by Peter_DK
Hi Kenmo.

Yeah...The idea using text/string gadgets would work, but
what I wanted was to freely position the data at positions
determined by coordinates set by me in an empty window.


You know..Something like the API: TexOut(hDC,X,Y,Str,Len(Str))

Anyway...The Image gadget will do the job for now.

Thanks for your input.

Best regards

Peter.