Mini Libs 0.3 (Formally named, Shannara Libs)

Developed or developing a new product in PureBasic? Tell the world about it.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Mini Libs 0.3 (Formally named, Shannara Libs)

Post by Shannara »

These are two mini libraries I put together. I am starting a collection of libraries of simple commands and such for PB users.. *shrugs* These will be used for the upcoming Crystal Dialog Designer for PB. It will soon be a full fledge IDE for PB. So... info below...

AppPath = Returns applicaton path
FileExist = Returns whether given file exist or not.
SetWindowTransparency = This will set a window's transparency, only works for windows 2000 and above.

http://www.pbcode.com/minilibs/MiniLibs0.3.rar

To Install: Extract libraries into your purebasic's UserLibraries directory, and restart the compiler.

The versioning have changed. The number represents the # of libraries included.

These are free to use for any reason, except claiming they are yours :D

I'll be posting more libraries and updates as I find the time.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

68 views and no comments :) No bugs, Im cruising along.. whee!
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1290
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Or maybe that it is so silly to have these simple commands in a user library that no one uses it?
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Maybe ;) After all, why have to remember to include an include file when you can easily just type the command. *shrugs*
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

Paul wrote:Or maybe that it is so silly to have these simple commands in a user library that no one uses it?
Full ACK
Mhh, have to look through Andrés Code-Archive in case there are other functions that could be TailBited.
Don't missunderstand me, I love TailBite and I've already done a Lib with it, but for my understanding it has to be a challenge to write a useful lib. Copying simple 5 lined Functions made by others simply doesn't fall into that category.

*duckinghidingandrunningaway*
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

True true :) Even though that has no relation to this thread...lol.
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

Shannara wrote:True true :) Even though that has no relation to this thread...lol.
Yes it has:
AppPath = Returns applicaton path

Code: Select all

; English forum: http://jconserv.net/purebasic/viewtopic.php?t=6122&highlight=
; Author: Danilo
; Date: 11. May 2003
; 
; by Danilo, 31.01.2003 
; 
Procedure.s ExePath() 
  ExePath$ = Space(1000) 
  GetModuleFileName_(0,@ExePath$,1000) 
  ProcedureReturn GetPathPart(ExePath$) 
EndProcedure 

MessageRequester("",ExePath(),0)
FileExist = Returns whether given file exist or not.
Can easily be replaced by a native command, i.e. FileSize
SetWindowTransparency = This will set a window's transparency, only works for windows 2000 and above

Code: Select all

; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=2415&highlight=
; Author: freedimension (based on VarX code, extended by Andre)
; Date: 30. September 2003

GoodOS = OSVersion() 
If GoodOS = #PB_OS_Windows_2000 Or GoodOS = #PB_OS_Windows_XP Or GoodOS = #PB_OS_Windows_Future 
  GoodOS = #True : Else : GoodOS = #False 
EndIf 

; SetLayeredWindowAttributes is only available for Win2000, WinXP - so we have this little version check included
Procedure SetWinOpacity (hwnd.l, Opacity.l) ; Opacity: Undurchsichtigkeit 0-255 
  SetWindowLong_(hwnd, #GWL_EXSTYLE, $00080000) 
  If OpenLibrary(1, "user32.dll") 
    CallFunction(1, "SetLayeredWindowAttributes", hwnd, 0, Opacity, 2) 
    CloseLibrary(1) 
  EndIf 
  ;MakeToolWindow(hwnd, 1)   ; activate this line, if you want to have a ToolWindow  (need user-lib ToolBar Prof. from Danilo)
EndProcedure 


hWnd=OpenWindow(0,0,0,300,300,#PB_Window_SystemMenu |#PB_Window_ScreenCentered,"testing...") 
If GoodOS 
  SetWinOpacity(hWnd, 100) 
EndIf

Repeat 
Until WaitWindowEvent() = #PB_Event_CloseWindow 
End 

; ExecutableFormat=Windows
; EnableXP
; EOF
At this point I'm not too happy with the practice of pushing many useless libs on the market. That's excactly what I feared when TailBite got public the first time, though I must commit that I'm using it myself. The difference however is, that making more complex libraries is conducive to PB. Libs like those above however will dilute the language in future.
At least you should create your own namespaces, for example by prepending SHR_ or the like.

BTW: That's Elisha Cuthbert in your avatar, isn't it? Very cute
Last edited by freedimension on Tue Jun 29, 2004 2:19 pm, edited 1 time in total.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

At least you should create your own namespaces, for example by prepending SHR_ or the like.
i have some discussions with frederic on irc about this topic.
So a prefix (like EL_ for ElChonis Libs or SHR_ or whatever ) for all commands sound's okay for us.
This is also to avoid problems with doubled named commands (like earlier).
Also most of us can say later that is a command from the SHR_ libraries for example.
Another one:
i also made some Commands with tailbite of some of my snippets (for example the Database-CreateDSN ones).Very fine to use later.
but i prefer release also the sourcecode (which is already present on purearea.net) to the commands ,so that if any problems occurs they can changed later.
SPAMINATOR NR.1
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Well, thats nice and all :D

This reminds me of a famous quote (I wish I knew who it originated from):

"Linux is free, if you do not value your time."

I believe that quote applys here. I create these personal libs because my time is valuable to me. Whatever helps me code faster is a big fat A+ in my book. After all, less time coding = more family time. Of if you have no family, more free time for other things. (like more coding, heh).

freedimension:

The reason for the name "Mini Libs" is just that. It is "mini", not "small". Simple one or two commands that makes coding easier, instead of having to do a 3 - 4 step process in order to get the command in your code, you just type the command (one step).

As for calling them useless, well, I guess that could be called an opinion. For those of us who prefer to save time, would say the opposite. Dispite what you believe, I believe that saving time is a .. well.. time saver.

Conductive to PB, I am going to assume that you mean adding new commands or great new features.. thats well and all, but saving time is also helpful. IF you call this deluting, then you must call all other libraries deluting as well.


Rings:

Would be great if Fred posted here as well. Come to think of it, if you guys agreed on having a prefix for all commands, that would be great. It should be written in the library design docs for the next version of PB or on the PB website somewhere so everybody can know, and change all of the libraries out there for PB to have prefixes :) Once that happens, I would gladly concur :)

No source here though, as mentioned in other threads, that basically takes away the purpose of having libraries. (for me).
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

"Linux is free, if you do not value your time."
what an idiot, the one that said that.
Well, you need to be a complete idiot if you cant get a simple distribution up and running in small time. And then adding server modules is also just a little reading, if you just want simple things..

but that quote must come from a totally brain damaged slow computer user...
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Or from the normal/average computer user. It does take time, and lots more time then a simple windows setup. Plus alot more knowledge (alot being in compared to running windows or a macOSX).

Zealotry simply have no place here.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1290
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Shannara wrote: The reason for the name "Mini Libs" is just that. It is "mini", not "small". Simple one or two commands that makes coding easier, instead of having to do a 3 - 4 step process in order to get the command in your code, you just type the command (one step).
By "namespace" he means make your commands unique so there will be no conflict in the future.
Example:
mini_AppName
mini_FileExist
mini_SetWindowTransparency

By using such obious names as simply "AppName", Fred may add this command to PB in the future and when this happens, your entire library is broken. (and yes, this has already happened in the past)
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Post by Max. »

thefool wrote:
"Linux is free, if you do not value your time."
what an idiot, the one that said that.
Well, you need to be a complete idiot if you cant get a simple distribution up and running in small time. And then adding server modules is also just a little reading, if you just want simple things..

but that quote must come from a totally brain damaged slow computer user...
No, the quote is very true; like the one along the lines "There ain't nothing like a free lunch".

And the quote has nothing to do that Linux is good or bad or whatsoever or that Windoze takes less or more time or whatsoever. It merely states a fact. Therefor serious companies calc the total cost of ownership. And other serious people do not install/use Linux because it's necessarily cheaper than a Windoze system, but because it fits the purpose better.

Anyway, I am somewhat disgusted by the amount of aggressivity in this thread. This does not reflect the PureBasic company I learnt to know.

You might find the lib useless. FFS, then just don't use it; ignore the thread & consider that most of your postings are useless for many guys as well; no matter how cunning the underlying idea!
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0
User avatar
NoahPhense
Addict
Addict
Posts: 2000
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

If you can't contribute to the original post. Start
something in the Off-Topic area of the forums.

- np
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

@Shannara

Can you add the DoEvents command? VERY, VERY uselfull:

Code: Select all

Proceduredll DoEvents() ; DoEvents for PureBasic
  msg.MSG 
  If PeekMessage_(@msg,0,0,0,1) 
    TranslateMessage_(@msg) 
    DispatchMessage_(@msg) 
  Else 
    Sleep_(1) 
  EndIf 
EndProcedure
Post Reply