String Gadget Length

Just starting out? Need help? Post your questions and find answers here.
Rookie
Enthusiast
Enthusiast
Posts: 106
Joined: Tue May 20, 2003 4:16 pm
Location: Florida
Contact:

String Gadget Length

Post 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 
Insanity is over rated, unless you can join me in mine.
Don't post questions at work
Don't post questions at work
Don't post questions at work
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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
BERESHEIT
Rookie
Enthusiast
Enthusiast
Posts: 106
Joined: Tue May 20, 2003 4:16 pm
Location: Florida
Contact:

Post 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.
Insanity is over rated, unless you can join me in mine.
Don't post questions at work
Don't post questions at work
Don't post questions at work
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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. :)
I may look like a mule, but I'm not a complete ass.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Just woundering, can the demo create executables after all?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post by milan1612 »

Yes, but there's a limit of about 800 lines of code and the debugger is always enabled...
Windows 7 & PureBasic 4.4
Rookie
Enthusiast
Enthusiast
Posts: 106
Joined: Tue May 20, 2003 4:16 pm
Location: Florida
Contact:

Post by Rookie »

Yep you can compile to 800 lines. This project might reach that. Gadgets take alot of line to work right.
Insanity is over rated, unless you can join me in mine.
Don't post questions at work
Don't post questions at work
Don't post questions at work
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Post 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:
Rookie
Enthusiast
Enthusiast
Posts: 106
Joined: Tue May 20, 2003 4:16 pm
Location: Florida
Contact:

Post by Rookie »

Not IncludeFile doesn't get around. Reason why you can't run one of the examples.
Insanity is over rated, unless you can join me in mine.
Don't post questions at work
Don't post questions at work
Don't post questions at work
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

personally i think it would be better if the demo, would not support loading libs, include binary files etc.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post 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
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post 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:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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? :)
I may look like a mule, but I'm not a complete ass.
Post Reply