Page 1 of 1

String Gadget Length

Posted: Sun Apr 27, 2008 1:37 am
by Rookie
Is there a demo friendly way to due this:

Code: Select all

SendMessage_(GadgetID(#YOUR_STRING_GADGET), #EM_LIMITTEXT, 4, 0)
; where 4 is the char limit you set 

Posted: Sun Apr 27, 2008 2:40 am
by netmaestro
The Windows API is available from the demo version of PB, it just isn't available directly. The functions aren't imported for you and the constants aren't predefined. So you have to do this work yourself, which is of course more coding than you would need to do if you had a full registered version. I recommend you buy one soon, it's a purchase you'll look back on in years to come as one of your very best.

So, what's the extra code required? This should work in the demo version:

Code: Select all

#EM_LIMITTEXT = $C5

Prototype SendMessage(hwnd, msg, wparam, lparam)
OpenLibrary(0,"user32.dll")
SendMessage_.SendMessage = GetFunction(0,"SendMessageA")

OpenWindow(0,0,0,320,240,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
StringGadget(0,10,10,100,20,"")
SendMessage_(GadgetID(0), #EM_LIMITTEXT, 4, 0) 

SetActiveGadget(0)

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
CloseLibrary(0)
End

Posted: Mon Apr 28, 2008 4:05 pm
by Rookie
I really don't have a reason to purchase it. i write small programs for me and a handful of people. Not worth the $99us for me. Programming is something I like to due for fun.

All they should due with the demo is forced the line limit and that is all. In my honest opinion.

Posted: Mon Apr 28, 2008 4:07 pm
by srod
In which case perhaps at least consider a small donation to Fred and co. You are using the result of years of their hard work after all. :)

Posted: Mon Apr 28, 2008 4:27 pm
by Fluid Byte
Just woundering, can the demo create executables after all?

Posted: Mon Apr 28, 2008 4:36 pm
by milan1612
Yes, but there's a limit of about 800 lines of code and the debugger is always enabled...

Posted: Mon Apr 28, 2008 6:34 pm
by Rookie
Yep you can compile to 800 lines. This project might reach that. Gadgets take alot of line to work right.

Posted: Mon Apr 28, 2008 10:01 pm
by UserOfPure
milan1612 wrote:here's a limit of about 800 lines of code
Does using IncludeFile get around that limitation? If so, it should be stopped.

Also, to Rookie: you say it's not worth $99, but you're happy to constantly use the demo to write programs for yourself and your friends? What's wrong with this picture? :roll:

Posted: Mon Apr 28, 2008 10:10 pm
by Rookie
Not IncludeFile doesn't get around. Reason why you can't run one of the examples.

Posted: Mon Apr 28, 2008 10:19 pm
by netmaestro
If you're happily writing and distributing programs with no intention of buying the product, you're breaking the spirit, if not the letter, of the Demo license. I had no idea this was the case when I answered your question.

Posted: Mon Apr 28, 2008 11:28 pm
by nco2k
personally i think it would be better if the demo, would not support loading libs, include binary files etc.

c ya,
nco2k

Posted: Mon Apr 28, 2008 11:37 pm
by rsts
Yeah, I always wondered why I had to pay for Windows, since I'm not making a profit off of it and only use it at home with my family :roll:

cheers

Posted: Tue Apr 29, 2008 3:32 am
by Rook Zimbabwe
I have always tought that the demo version should NEVER compile... It is useless... run from the IDE and you know if you can create code in PB and if you like what you are doing. All else invites codebois and script kiddies to smurf on and post useless questions about how to hijack the Enviroment. :twisted:

Posted: Tue Apr 29, 2008 12:37 pm
by Derek
Rook Zimbabwe wrote:I have always tought that the demo version should NEVER compile...... run from the IDE and you know if you can create code in PB
I agree, it should let you try it, which it would but it shouldn't let you create exe's.

Posted: Tue Apr 29, 2008 12:40 pm
by srod
If it were me I'd scrap the demo version completely. I think PB is established enough that it no longer needs the demo etc.

Still, what do I know? :)