Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Newbie having trouble with brush1.New1()


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2008, 09:59 PM
Junior Member
 
Join Date: May 2008
Posts: 24
Default Newbie having trouble with brush1.New1()

I grabbed a coding example from the forum that includes the line

brush1.New1(cBlue)

But whatever I do with the parameter (using a varable or RGB()) I get a pop-up saying that the "parameter is not valid".

What could be causing this, please?

(I am a complete newbie with Basic4PPC trial edition, hoping to make enough progress to justify a purchase. But I have decades of programming experience in multiple languages.)

Mike.
Reply With Quote
  #2 (permalink)  
Old 05-25-2008, 10:04 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,127
Default

Hi Mike,

Could you post your code?
What version of Basic4Ppc are you using?
Is the error relative specificaly to that code line?
Did You had the necessary DLL in the components, and the apropiate object?

Cheers
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

Last edited by Cableguy : 05-25-2008 at 10:07 PM.
Reply With Quote
  #3 (permalink)  
Old 05-25-2008, 10:45 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 516
Awards Showcase
Competition Winner 
Total Awards: 1
Default

After having installed the library and added a brush object, you must initialize the object with:
brush1.New1(cBlue) or
brush1.New1(RGB (100,124,55))

Afterwards you can modify it's color whenever you want with:
brush1.Color = cRed or
brush1.Color = RGB (100,100,100)

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #4 (permalink)  
Old 05-26-2008, 10:39 PM
Junior Member
 
Join Date: May 2008
Posts: 24
Default Newbie having trouble with brush1.New1()

Thanks for your prompt replies.

The code isn't "mine"; as I said I just got it from a tutorial so I had to work out how to create the matching objects.
Sub Button1_Click
bitmap1.New2(100,100)
rect1.New1(0,0,bitmap1.Width,bitmap1.Height)
drawer.New2(bitmap1.Value, B4PObject(5)) 'The drawer will draw on bitmap1
brush1.New1(cBlue)
drawer.FillRectangle(brush1.Value,rect1.Value)
brush1.Color = cBlue
rect1.Width = 40
drawer.FillEllipse(brush1.Value,rect1.Value)
form1.DrawImage(bitmap1.Value,10,10) 'Draws bitmap1 on form1
End Sub
If I try retyping the offending line, the hint I get does not include any NewX() with a color parameter. Example: New2(width, height) instead. If I change the code then I get past the problematic line to the next one (which also fails).

I cannot believe that you-all would publish sample code that does not work, so what is happening?

Cheers, Mike.
Reply With Quote
  #5 (permalink)  
Old 05-27-2008, 04:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,847
Default

I don't see any problem with this code.
You can download and test it.
Attached Files
File Type: zip ImageLib.zip (3.9 KB, 1 views)
Reply With Quote
  #6 (permalink)  
Old 05-27-2008, 09:43 AM
Junior Member
 
Join Date: May 2008
Posts: 24
Default

Thank you Erel, I have tried your ImageLib.zip and it works just as you say. Also when I alter the "brush1.New1()" line the hint says that the parameter is just "color", which fits the code. I shall just have to go back and try to repeat what I was doing before more carefully!

Cheers, Mike.
Reply With Quote
  #7 (permalink)  
Old 05-28-2008, 07:11 PM
Junior Member
 
Join Date: May 2008
Posts: 24
Default

Yes, I eventually verified that I had created my brush1 as the wrong type of object. In the desktop that could easily be seen but I don't know how to see it on the device. I just checked the hint list of methods which didn't match Brush. Could the object type be displayed somehow, perhaps in the Delete-object list?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sms.New1(Number,Text) not working after compilation Graley Bug Reports 2 05-19-2008 01:50 PM
Table trouble Lasse Questions & Help Needed 1 01-15-2008 09:37 PM
Table Trouble RandomCoder Questions & Help Needed 2 07-15-2007 09:07 AM
Table trouble RandomCoder Questions & Help Needed 5 05-09-2007 06:31 AM
addimage trouble Cableguy Questions & Help Needed 5 05-08-2007 08:29 PM


All times are GMT. The time now is 01:50 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0