It is currently Sun Jul 21, 2019 1:53 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Sun Jan 27, 2008 5:25 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6061
Superadnim, cool off, step back. That's trolling and you know it. Comments like those only make me react in one way:

YOU write something better, and THEN you're allowed those kind of comments.

(Show us something you wrote, then WE can laugh.)

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X 32GB RAM Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 28, 2008 12:48 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Jul 05, 2005 2:42 pm
Posts: 122
Location: berrypatch
If I remember correctly, Superadnim has been warned at least once before about this kind of behavior.

Shame some people just don't learn.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 24, 2008 8:06 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jul 03, 2003 6:53 pm
Posts: 1271
Location: England
mk-soft you rock.

superadnim - is he really super?

Write your answers on the back of a five pound note and send them to:
the.weavster
...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 28, 2008 9:19 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Hi,

For which you use my Precompiler and run it?

Need still for the advancement still two stable functions with rollback.
Code:
Procedure RegDLL(ProgID.s, CLSID.UIID, InprocServer32.s = "Apartment")

EndProcedure

Procedure UnregDLL(CLSID.UIID)

EndProcedure

who can help me?

Thanks :wink:

P.S. Helpertools for UUID as DataSection is Ready. Download UuidGenerate

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 24, 2008 3:51 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Simply OOP Dialog example. Using Threadsave.

Code:

Class DlgWindow Extends BaseClass
  ; Attributes
  WinID.l
  hThread.l
  Exit.l
  Caption.s
EndClass


; Method DlgWindow_Function(*this.DlgWindow)
;
;   With *this
;   
;   EndWith
;   
; EndMethod

Method DlgWindow_Create(*this.DlgWindow)

  With *this
    \WinID = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 300, 200, \Caption)
   
  EndWith
 
EndMethod

Method DlgWindow_Event(*this.DlgWindow)
 
  Protected event.l
 
  With *this
    Repeat
      event = WaitWindowEvent()
      Select event
        Case #PB_Event_CloseWindow
          \Exit = #True
      EndSelect
    Until \Exit
    Debug "Exit Thread ID " + Str(\hThread)
    CloseWindow(\WinID)
  EndWith
 
EndMethod

Method DlgWindow_IsExit(*this.DlgWindow)

  ProcedureReturn *this\Exit
 
EndMethod


; Private
Procedure DlgInit(*this.IDlgWindow)
  *this\Create()
  *this\Event()
EndProcedure

Method DlgWindow_Run(*this.DlgWindow, Caption.s)

  With *this
    \Caption = Caption
    \hThread = CreateThread(@DlgInit(), *this)
  EndWith
 
EndMethod

; Test
Define.IDlgWindow *dlg1, *dlg2

*dlg1 = NewObject(DlgWindow)
*dlg2 = NewObject(DlgWindow)
*dlg1\Run("Diaglog 1")
*dlg2\Run("Diaglog 2")

Debug "Start.."
Repeat: Delay(100) : Until *dlg1\IsExit() And *dlg2\IsExit()

*dlg1\Release()
*dlg2\Release()

Debug "Ready."


GT :wink:

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 24, 2008 11:27 pm 
Offline
User
User

Joined: Sun Dec 14, 2003 6:38 pm
Posts: 84
Location: Germany, Mechernich
very impressive.

i tried with that, and i'm missing a 'Super'-Var/pointer to call a method on the class from we inherited.
(Maybe as a pointer).

With that we can use also the functionality from the 'Parent'-Object.
Say - if we write a Baseclass that has the functionality to serialize itself (only the important vars). If we derive from that we also 'overwrite' the serialize-function. but instead to serialize all the vars, we only call the 'Parent' (in java as Super())-Function (it serialze the vars of the parent object, and now we only have to serialize the vars we need for my class (members).


Mike


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 25, 2008 12:23 am 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Sorry, i don´t understand complete what you mean. (my english)

but when you need a method from myclass, only define the method from myclass.

Code:
Class MyClass Extends BaseClass
  ; Attributes
EndClass

Method MyClass_Function1(*this.MyClass)
  With *this
    Debug "Test 1"
  EndWith
EndMethod

Method MyClass_Function2(*this.MyClass)
  Protected *self.iMyclass = *this
  With *this
    *self\function1()
  EndWith
EndMethod

*obj.imyclass = NewObject(myclass)
*obj\function2()


This is all for self and inherited method, not parend class object because is not exists.

P.S. I added an optional parameter by NewObject(Class, ParendClass) at time.

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 25, 2008 1:18 pm 
Offline
User
User

Joined: Sun Dec 14, 2003 6:38 pm
Posts: 84
Location: Germany, Mechernich
mk-soft wrote:
Sorry, i don´t understand complete what you mean. (my english)

Same for my english... if germans write english... ;-)

But i think it is also interesting for the people here around. So i try to explain this a little bit more (next try..)
Say i have a Baseclass like :
Code:
Class cBase
    cBase()
    serialize(*xml_node)
    deserialize(*xml_node)
    id.l
    name.s
    type.l
EndClass

Procedure cBase.cBase()
EndProcedure

Procedure cBase.serialize(*xml_node)
  ;
  ;.. write id, name and type as tags to the xml.
  ;
EndProcedure

Procedure cBase.deserialize(*xml_node)
  ;
  ;.. read id, name and type as tags from the xml.
  ;
EndProcedure



Now i want hav a class the derives from the base class :
Code:
Class cAction
  cAction()
  execute()
  serialize(*xml_node)
  deserialize(*xml_node)
;now only the vars for this Action
;we iherited the id,name and type from the base-class
  actionName.s
  actionPath.s
  actionTimeout.l
EndClass

Procedure cAction.cAction()
    ;; should able to call the parent Constructor
    ;; for basic initis.
   ;;but without knowing the name of the Base-Class
EndProcedure

Procedure cAction.execute()
   ;;Do the Action
EndProcedure

Procedure cAction.serialize(*xml_node)
    ;;call parent first
    *parent\serialize(*xml_node)
  ;;
  ;; now write my own vars to the xml
EndProcedure


Procedure cAction.deserialize(*xml_node)
    ;;call parent first
    *parent\deserialize(*xml_node)
  ;;
  ;; now read my own vars from the xml
EndProcedure



This ends up with the 'feature' that i can have a Array or LinkedList filled with different action-objects, but i have only to call 'execute() to start the action, and using a serialize() to write them (completly) or a deserialize() to read them back.
I have not to know the parent of a class. That should be capsuled via OO.

I hope that clears what i want . So i was a C++/Java man, and i wrote the Pattern (Command-Pattern) often enough. And i really like it much.
Would be nice - and important - to get that work.

BTW: I cannot understand Fred with his ignorance against OOP. He gives us the Interface as a basic step to OOP but denies support via Compiler.
So he has not to reinvent the complete Purebasic only to add a feature. that the people can use - if the want. Maybe as for some extra cash.
(i would pay for that !)
But its a fact that OO is a good solution for greater projects.

Mike








EndClass


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 25, 2008 7:18 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Update v0.35 (Only Windows, Linux at time)

NewObject calling the Method "InitObject()". Now can overwrite this method for initialzed the object.

example:
Code:
; Example Part 3 - avoidance of memory leak with self method Release

Class MemClass Extends BaseClass
  *mem1
  *mem2
EndClass

; Init memory
Method Overwrite MemClass_InitObject(*this.MemClass) ; <- NewObject call InitObject
  With *this
    Debug "InitObject: AllocateMemory."
    \mem1 = AllocateMemory(10*1024)
    \mem2 = AllocateMemory(20*1024)
  EndWith
EndMethod

Method MemClass_GetMemPointer(*this.MemClass, number.l)
  Select number
    Case 1 : ProcedureReturn *this\mem1
    Case 2 : ProcedureReturn *this\mem2
    Default : ProcedureReturn 0
  EndSelect
EndMethod

Method Overwrite MemClass_Release(*this.MemClass)
 
  ; Decrease internal refcounter
  If *this\__Ref > 1
    *this\__Ref - 1
    ProcedureReturn *this\__Ref
  Else
    Debug "Release: Free Memory."
    FreeMemory(*this\mem1)
    FreeMemory(*this\mem2)
    ; Release Object
    ProcedureReturn DeleteObject(*this)
  EndIf

EndMethod



; Test Part 3
Debug "Test Part 3"
Debug ""
Debug "Mem Test 1"
*mem.IMemClass = NewObject(MemClass)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
*mem\Release()
Debug ""

Debug "Mem Test 2"
*mem.IMemClass = NewObject(MemClass)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
*mem\Release()
Debug ""


GT :wink:

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 26, 2008 2:40 am 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Update v0.36

Bugfix: InitObject()

------------------------------
Edit
Super var-pointer does not correspond the COM objects to specification. There tries to remain compatible for later DLL´s for these will not integrate itself. Who white still another solution those the integrity does not injure.

Sorry,
------------------------------


I have still no solution for parent method.
Code:

Class cBase Extends BaseClass
  ; Method
  ; cBase()
  ;serialize(*xml_node)
  ;deserialize(*xml_node)
  ; Attribues
  id.l
  name.s
  type.l
EndClass

Method cBase_InitObject(*this.cBase)

EndMethod

Method cBase_serialize(*this.cBase, *xml_node)
  ;
  *this\name = "cBase Serialize"
  ;
EndMethod

Method cBase_deserialize(*this.cBase, *xml_node)
  ;
  ;.. read id, name and type as tags from the xml.
  *this\name = "cBase deserialize"
  ;
EndMethod


Class cAction Extends cBase
  ; inherited methods
  ;serialize(*xml_node)
  ;deserialize(*xml_node)
  ; Methods
  ;cAction()
  ;execute()
  ;now only the vars for this Action
  ;we iherited the id,name and type from the base-class
  actionName.s
  actionPath.s
  actionTimeout.l
EndClass

Method Overwrite cAction_InitObject(*this.cAction)
  ;; should able to call the parent Constructor
  ;; for basic initis.
  ;;but without knowing the name of the Base-Class
EndMethod

Method cAction_execute()
   ;;Do the Action
EndMethod

Method Overwrite cAction_serialize(*this.cAction, *xml_node)
    ;;call parent first
    cbase_serialize(*this, *xml_node) ; <- Call old method: I have still no solution
    Debug *this\name
    ;;
    ;; now write my own vars to the xml
EndMethod


Method Overwrite cAction_deserialize(*this.cAction, *xml_node)
    ;;call parent first
    cbase_deserialize(*this, *xml_node)
    Debug *this\name
    ;;
    ;; now read my own vars from the xml
EndMethod

*obj.icAction = NewObject(cAction)
*obj\serialize(100)
*obj\deserialize(100)
[/b]

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 01, 2008 1:38 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Update v0.36

Linux version now available

GT :wink:

P.S. OOP-Dialog under a linux not running :?: :?: :?:

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 03, 2008 4:11 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1769
Location: Germany
Update v0.37

Structure BaseClass have now a pointer to parent object :wink:

Chaos example:
Code:
; Example for parent object
; Structure BaseClass have now a pointer to parent object

Class Sub Extends BaseClass
  text.s
EndClass

Class Master Extends BaseClass
  ; Attribute
  text.s
  sub.ISub[20]
EndClass


; Sub Class Methods

; Method Sub_Function(*this.Sub)
;   With *this
;   
;   EndWith
; EndMethod

Method Sub_InitObject(*this.Sub)
  With *this
    Debug "Parent Pointer: " + Str(\parent)
  EndWith
EndMethod

Method Sub_Test(*this.Sub)
  Protected *parent_data.master = *this\parent ; Set pointer to parent data
  Protected *parent_method.imaster = *this\parent ; Set pointer to parent interface
  With *this
    \text = "SubText = Parent Text -> " + *parent_data\text 
    Debug \text
    Debug "Parent Method GetText() = " + *parent_method\GetText()
  EndWith
EndMethod


; Master Class Methods

; Method Master_Function(*this.Master)
;   With *this
;   
;   EndWith
; EndMethod

; Method Init Object

Method Master_InitObject(*this.Master)
  With *this
    \text = "Hello Master Text"
  EndWith
EndMethod

Method.s Master_GetText(*this.Master)
  With *this
    ProcedureReturn \text
  EndWith
EndMethod

Method Master_NewSub(*this.Master, ID)
  With *this
    \sub[ID] = NewObject(sub)
    ProcedureReturn \sub[id]   
  EndWith
EndMethod

*master.imaster = NewObject(master)
Debug *master\gettext()

*sub1.isub = *master\NewSub(0)
*sub1\test()


Who writes a better example

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 03, 2008 8:11 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 17, 2007 10:28 am
Posts: 141
Location: P.O.P
really good work!

_________________
POiNT.OF.PRESENCE group


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 03, 2008 8:34 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 17, 2007 10:28 am
Posts: 141
Location: P.O.P
superadnim wrote:
I guess I'll have to continue mine after all...

Chatter and chatter :lol:

_________________
POiNT.OF.PRESENCE group


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed May 07, 2008 8:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 17, 2007 10:28 am
Posts: 141
Location: P.O.P
Fatal error!

Code:
XIncludeFile #PB_Compiler_Home + "somefile.pbi"
Class MyClass Extends BaseClass
EndClass

- not works (Syntax error, topfile.oop not created)!

Code:
XIncludeFile "d:\PB4\somefile.pbi"
Class MyClass Extends BaseClass
EndClass

- works (not always - e.g. I can't include DX9-includes by Steven (Dreglor) Garcia)!

Fix please?

@inc
You have this problem too (remind my issue?)

_________________
POiNT.OF.PRESENCE group


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye