Results 1 to 10 of 10

Thread: Whoa

  1. #1

    Thread Starter
    Hyperactive Member rEaL iGoR's Avatar
    Join Date
    Apr 2001
    Location
    A secret!
    Posts
    417

    Whoa

    Hello, and welcome

    Today I want to ask on about my dragon-problem. Not the same ol' stupid question, I've figured that out. But my new topic is still related to the issue of object-oriented programming.

    If you haven't read my previous thread:
    I have a dragon which I call 'Drag'. It's a class module called Drage and a 'Drag' which is a 'Drage'

    Option Excplict
    Public Drag as New Drage

    But this control, Drage, needs a picture to display itself on the screen. I've used the coding:

    Dim Monster1 As Image
    Set Monster1 = frmBane.Img
    With Monster1
    .Picture = LoadPicture(App.Path & Drag.Pic1)
    .Left = Drag.StartPosL
    .Top = Drag.StartPosT
    End With

    And I've created an Image with the picture of a dragon. However, I am not able to control the Image Control directly from the Class Module, something which is vitally dramatic when I'm trying to build the Method called 'MoveDragon'. So I wonder, does anyone have an idea on how to Either:

    Give my dragon class a picture, Left and Top Property OR
    Give my dragon full authorization of controling the Image Control.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    It's because 'monster1 as image' makes a MEMORY image; not on any form.

    You could have a picturebox property for the 'Drage' and then link a picturebox to it ByRef (IMPORTANT !), and then control it that way.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Hyperactive Member rEaL iGoR's Avatar
    Join Date
    Apr 2001
    Location
    A secret!
    Posts
    417

    Hmmm

    Really...Explain, please. I'm new at theese sort of things.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Well, make a PROPERTY in your 'Drage' CLASSMODULE called Linked, and make it's TYPE be PICTUREBOX.

    Then, when you say: Public Drag as New Drage, follow it with:
    Drag.Linked = Picture1

    Then, you can say stuff in your classmodule like:
    'varLinked = a local copy
    varLinked.Left = 150i0912871 'whatever
    varLinked.Picture = 1092578rqfkjacs 'once again, whatever
    varLinked.Bottom = 29751q09jfsa;lz

    or...

    DONT make a LINKED PROPERTY.
    Have a thing that translates codes from the classmodule into the form:

    Picture1.Left = Drag.Left
    Picture1.Top = Drag.Top
    Picture1.Picture = Drag.Picture

    ...

    etc.

    Do you get what I mean?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5

    Thread Starter
    Hyperactive Member rEaL iGoR's Avatar
    Join Date
    Apr 2001
    Location
    A secret!
    Posts
    417

    Humpdi

    Yeah, I think I get what you mean, but what can I use to translate code from the class module to the form?

    Picture1.Picture = LoadPicture(AZpp.Path & Drag.Pic1)

    will not be accepted in the class module.... so?
    There's probably some silly things i've forgot and it all seems very stupid, but....how?

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Your original idea makes more sense, having an image reference wrapped by the drage class, at least from a OOP point of view.
    The image should thought be assigned by using a call, using a property. Monster1 has to be module scope.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Zaei
    Guest
    Ok, first, to make a reference to a control, you have to SET Drage.Linked = Picture1. Second, the code should be App.Path & "\" & Drag.Pic. Just a few points.

    Z.

  8. #8

    Thread Starter
    Hyperactive Member rEaL iGoR's Avatar
    Join Date
    Apr 2001
    Location
    A secret!
    Posts
    417

    YES!

    Zaei, you're an angel. However, the coding would not be
    LoadPicture(App.Path & "\" Drag.Pic2) as I use the backslash in my pic2 property, with that I mean
    With Drag
    .Pic2 = "\holaSenorite.Gif"
    end With

    or similar...However, the SET thing helped me out a lot! I owe you one. Take Care, Bye for now!

  9. #9
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Oh yeah, but I did nothing....
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  10. #10
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    No!

    It was sarcastic, it's okay.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width