NetTalk Central

Author Topic: NT WebServer and Custom CLASSes  (Read 5216 times)

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
NT WebServer and Custom CLASSes
« on: October 30, 2017, 03:45:32 AM »
Hello All,

I have began the process of writing my own CLASS for the purposes of relocating the many small code snippets I use in my NTWS apps under one roof.  It has been succesful so far and it has been an eye opening experience.  I wished I would have tried this a long long time ago!!

Anyway, I have successfully used "inheritence" to use NT, String Theory, and other methods in my class.  One thing I haven't figured out is how to pass a FileName, FieldName, Key, etc., to a procedure in my CLASS.  

I'm pretty sure I can design my procedure with something like:

myprocedure(FILE pSomeFile, FIELD pSomeField, KEY pSomeKey)

But, and I guess my question boils down to this, how do I bring the Clarion ABC FileManger into my CLASS?  How do I make my class inherit the FIleManager CLASS(s) the same way I did for NT and String Theory?

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PART TWO:

Once I get my CLASS up and running, I would like to share it with the NetTalk community.  There has got to be some things I do that someone else will find useful.  I will wrap my CLASS in a template to make it easier to use.  I will provide the template to Bruce, and if he approves, I will share it here at NetTalkCentral.  

One thing that I want to include in my CLASS is a table that I created that recreates most of the main features of the NT Planner.  It has:

* Customized Right Side Headers via CSS
* Left Side Column with Clickable Cells that Open a Form as a Popup
* Right Data Cells that Open Popup Form

Why did I recreate the planner?  Well, I loved the planner, but I was using it such a way that it was not intended on being used.  I used it to track the monthly work schedule of the officers on my shift. (I am a law enforcement shift commander over another supervisor (sergeant) and around 10 officers.)  I could never get the NT planner to display correctly.  Let me clarify, I could get the top headers (the dates) to align with the data columns at, say, 100% zoom in the web browser.  Zooming in or zooming out would break that alignment.  So I created a very simple table and slowly added the features I loved about the NT planner.

Anyway, I will provide all of this to Bruce to do with what he wants.  If he is ok with it, I will provide it to everyone.  Or, maybe Bruce could add it to NT as another option for his cutomers.  Basically it will be up to him as my CLASS relies on NT and it's his playground so to speak.

Anyway, I know I rambled on quite a bit but I hope to add something positive to NT that everyone can find useful.  I have attached some screen captures.

Thank you for your time,

Don

« Last Edit: October 30, 2017, 03:52:42 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT WebServer and Custom CLASSes
« Reply #1 on: October 31, 2017, 12:29:13 AM »
>> and I guess my question boils down to this, how do I bring the Clarion ABC FileManger into my CLASS?

you add a FileManager parameter. so;

myprocedure(FILEMANAGER pSomeFileManager, FIELD pSomeField, KEY pSomeKey)

then in the code you can have
  pSomeFileManager.Open()
  pSomeFileManager.UseFile()

and so on.

the actual file handle (if you still need it) is pSomeFileManager.Me

>> I will provide the template to Bruce, and if he approves, I will share it here at
NetTalkCentral. 

my approval is not necessary <g>.

Cheers
Bruce

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NT WebServer and Custom CLASSes
« Reply #2 on: October 31, 2017, 02:47:35 AM »
I was told in comp.lang.clarion NG that it probably couldn't be done.  

So, I CAN access a table in my dictionary by passing the table name, field name, etc., via parameters to my CLASS?

To say I cannot seems to go against the very idea that the ABC classes/OOP is based upon.

THANK YOU!!!!!!

UPDATE:  Hey Bruce.  Do you have an example of this in one of your NetTalk classes? 

« Last Edit: October 31, 2017, 02:57:17 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NT WebServer and Custom CLASSes
« Reply #3 on: October 31, 2017, 03:49:59 AM »
I keep getting, "No matching prototype available."

Calling procedure:
MyClass.TickerTape_Default(TickerTapeMessage,Tic:TickerIdKey,Tic:TickerMessage,pPacket)

Class Procedure
DonRidleyClass.TickerTape_Default           PROCEDURE  (FileManager pFM,KEY pKey,STRING pMarqueeText,*STRING pReturnPacket) ! Declare Procedure
! ----- st --------------------------------------------------------------------------
st                   StringTheory
packet               StringTheory
p_web                NetWebServerWorker           ! Generated by NetTalk Extension (Class Definition)

  CODE
  Blah Blah Blah
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT WebServer and Custom CLASSes
« Reply #4 on: November 01, 2017, 12:11:01 AM »
>> I keep getting, "No matching prototype available."

So the "caller" and the "callee" need to be using parameters of the same type.

DonRidleyClass.TickerTape_Default         PROCEDURE 
(FileManager pFM,KEY pKey,STRING pMarqueeText,*STRING pReturnPacket)

So problem here, but then the caller MUST pass (explicitly) a
FileManager, Key, <something>, String

so the error is telling you that you aren't doing that.

>> Calling procedure:
>> MyClass.TickerTape_Default(
>> TickerTapeMessage,Tic:TickerIdKey,Tic:TickerMessage,pPacket)

Is TickerTapeMessage a FileManager object? Doesn't look like one. 'd be expecting something like  Access:TickerTapeMessage there ...

is pPacket a String? Not a Cstring or StringTheory etc.

Incidentally, given that your class is using StringTheory you might find it easier to use StringTheory objects for return values - then they are not size restricted. so

DonRidleyClass.TickerTape_Default           PROCEDURE  (
FileManager pFM,KEY pKey,STRING pMarqueeText,StringTheory pReturnPacket)

In this case then pPacket would be a stringTheory object as well.

cheers
Bruce


DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NT WebServer and Custom CLASSes
« Reply #5 on: November 01, 2017, 07:49:36 AM »
Ah ok.

Great advice to use String Theory object!!

Thank you!!!!!!
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11