dbTalk Databases Forums  

TechTips: Using libraries for common storage

comp.databases.paradox comp.databases.paradox


Discuss TechTips: Using libraries for common storage in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike Robinson
 
Posts: n/a

Default TechTips: Using libraries for common storage - 02-02-2006 , 12:26 PM






As you know, a Paradox "application" consists of many parts: scripts,
forms, reports, and libraries. What you may not know is that most of these
are actually Windows DLLs. This means that, courtesy of Windows, they are
neatly self-contained and inherently shareable.

But independence, as any new kid in college will tell you, does have its
drawbacks. How can you enable the various independent forms to share
information easily? The answer is: libraries.

A library (.LSL, .LDL) is a unit that contains only executable (ObjectPAL)
code. It also contains its own set of global variables. Any form(s) in
your Windows session can open the same library at the same time, and when
they do so, they all access a single common /instance/ of that library.
Thus, the same instance-data: the same global variables.

Now, there's unfortunately no way for a form to _directly_ access a
library's variables, but you can provide a pair of /methods/ to do so...

assume:
var
globals DynArray[] AnyType
endVar

Now:
method getValue(key String) AnyType
return globals[key]
endMethod
and:
method setValue(key String, toValue AnyType)
globals[key] = toValue
endMethod

A library is a great place to put "most of your application," because not
only does it allow a single copy of the code to be shared, it also allows
all kinds of common data to be kept there.

There's only one caveat: the library must not be closed, even for a moment.
One way to do that is to have a "main menu" form open the library, and then
for the form to remain open throughout the life of the application.



Reply With Quote
  #2  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-02-2006 , 02:22 PM






Mike
<<
What you may not know is that most of these are actually Windows DLLs.
Quote:
IMO, that's an old myth. When I asked Dan Alder about this a couple of years
ago, he said, forms, and libraries have the structure of a DLL, but they
aren't really DLLs.



--
Bertil Isberg - CTECH
Paradox buglist:
online: http://web.comhem.se/~u82608896/

"Mike Robinson" <info (AT) sundialservices (DOT) com> skrev i meddelandet
news:43e24ed2 (AT) pnews (DOT) thedbcommunity.com...
Quote:
As you know, a Paradox "application" consists of many parts: scripts,
forms, reports, and libraries. What you may not know is that most of
these
are actually Windows DLLs. This means that, courtesy of Windows, they are
neatly self-contained and inherently shareable.

But independence, as any new kid in college will tell you, does have its
drawbacks. How can you enable the various independent forms to share
information easily? The answer is: libraries.

A library (.LSL, .LDL) is a unit that contains only executable (ObjectPAL)
code. It also contains its own set of global variables. Any form(s) in
your Windows session can open the same library at the same time, and when
they do so, they all access a single common /instance/ of that library.
Thus, the same instance-data: the same global variables.

Now, there's unfortunately no way for a form to _directly_ access a
library's variables, but you can provide a pair of /methods/ to do so...

assume:
var
globals DynArray[] AnyType
endVar

Now:
method getValue(key String) AnyType
return globals[key]
endMethod
and:
method setValue(key String, toValue AnyType)
globals[key] = toValue
endMethod

A library is a great place to put "most of your application," because not
only does it allow a single copy of the code to be shared, it also allows
all kinds of common data to be kept there.

There's only one caveat: the library must not be closed, even for a
moment.
One way to do that is to have a "main menu" form open the library, and
then
for the form to remain open throughout the life of the application.





Reply With Quote
  #3  
Old   
Sundial Services
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 10:42 AM



Bertil Isberg wrote:
Quote:
What you may not know is that most of these are actually Windows DLLs.


IMO, that's an old myth. When I asked Dan Alder about this a couple of
years ago, he said, forms, and libraries have the structure of a DLL, but
they aren't really DLLs.
They do show up as loaded modules. Paradox is using the memory management
capabilities of Windows, although the contents of the DLL are basically
employed as a non-executable /resource/ ...

----
ChimneySweep(R): F-A-A-ST table repair at a click of the mouse!
http://www.sundialservices.com/products/chimneysweep


Reply With Quote
  #4  
Old   
Jean Friedberg
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 02:16 PM




"Mike Robinson" <info (AT) sundialservices (DOT) com> wrote


Who is Mike Robinson?



Reply With Quote
  #5  
Old   
Rodney Wise
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 02:26 PM



Mike,

Have you tried storing graphic images in a Library (as in DLL'ss) which can
be shared with Forms?



--
....
`·.¸¸.·´¯`·.¸¸.·´¯`·-> rodney



Reply With Quote
  #6  
Old   
janM
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 03:12 PM




Quote:
Have you tried storing graphic images in a Library (as in DLL'ss) which can

be shared with Forms?



For win versions < XP the graphics look fine within paradox, when they are
directly extracted from the dll with api calls.
But with win XP they don't. You have to extract them to hard disk first and
use readFromFile.
IMHO, the reason is that paradox can not handle 32 bit graphics and the api
calls handle the graphics - bitmaps as 32 bit graphics in XP although they
are stored as max. 24 bits in the dll. Extracting to hard disk can force
the bitmap to be max. 24 bit.

Jan



Reply With Quote
  #7  
Old   
Rodney Wise
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 03:27 PM



Jan,

If the Image file is already stored in a Paradox Object (such as a Paradox
Library), then there won't be any further resolution degradation.

I found a way to store Image files in a Paradox Library and call them into
one or more Form(s) Graphic objects. Very much like using a DLL.
)



--
....
`·.¸¸.·´¯`·.¸¸.·´¯`·-> rodney



Reply With Quote
  #8  
Old   
Steven Green
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 04:16 PM



"Jean Friedberg" <jfriedberg (AT) mycomcast (DOT) com> wrote

Quote:
Who is Mike Robinson?
Mike *is* Sundial..


--
Steven Green - Waldorf Maryland USA

Diamond Software Group
http://www.diamondsg.com/main.htm
Paradox Support & Sales - Corel CTech Paradox

Diamond Sports Gems
http://www.diamondsg.com/gemsmain.htm
Sports Memorabilia and Trading Cards




Reply With Quote
  #9  
Old   
Sundial Services
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-03-2006 , 08:40 PM



Steven Green wrote:

Quote:
"Jean Friedberg" <jfriedberg (AT) mycomcast (DOT) com> wrote in message
news:43e3bac3$1 (AT) pnews (DOT) thedbcommunity.com...

Who is Mike Robinson?

Mike *is* Sundial..

Well, not exactly anymore, but the original author of ChimneySweep, well,
yes...


----
ChimneySweep(R): F-A-A-ST table repair at a click of the mouse!
http://www.sundialservices.com/products/chimneysweep


Reply With Quote
  #10  
Old   
janM
 
Posts: n/a

Default Re: TechTips: Using libraries for common storage - 02-04-2006 , 04:14 AM




Rodney,


Quote:
If the Image file is already stored in a Paradox Object (such as a Paradox

Library), then there won't be any further resolution degradation.

I found a way to store Image files in a Paradox Library and call them into

one or more Form(s) Graphic objects. Very much like using a DLL.
)
Interesting !
For 'classic' resource only dll, I create a .rc script then with rc.exe I
create a .res file. This .res file then is added to a .dll delphi project.
I must admit that I don't see how to add this .res file to a paradox library.
Perhaps you are willing to share your knowledge to do so?

Jan



Reply With Quote
Reply




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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.