Announcement

Collapse
No announcement yet.

Globally assign Class?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Globally assign Class?

    I have a class that I'd like to access it's methods from many different subs and functions. Is there a way to globally assign MyClass? (ie: GLOBAL Stuff AS NEW MYCLASS ) Or do I have to always LET Stuff = CLASS "MyClass" in every sub and function of my application?

  • #2
    Try making your Interface global and then you only have to do the Class assignment once, preferably in PBMAIN.

    Code:
    Global Stuff As StuffInterface
    
    Function PBMAIN() As Long
    
       LET Stuff = CLASS "MyClass" 
    
    End Function
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

    Comment


    • #3
      If its possible, (and probably is, but I wont go there), Depending on your application, it may be more advisable to keep local (as MCM would say under "Procedural" code), but thats just me spouting off a thought

      Objects and COM are way too new for me to mess with (without my trappings of a VB background to give a REAL answer) but gut feeling tells me to follow the PB examples and learn from those to try and avoid a "VB Train of Thought"
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

      Comment


      • #4
        Thanks Paul. Just tried that and it works the way I hoped.

        Cliff, I know what you mean and am doing this as a matter of "convenience". It's a direct interface and isn't a COM object.

        Comment


        • #5
          Hi Bill - no problem..... and welcome to the Community!
          Paul Squires
          FireFly Visual Designer (for PowerBASIC Windows 10+)
          Version 3 now available.
          http://www.planetsquires.com

          Comment

          Working...
          X