Formlib problem

Discussion in 'Questions (Windows Mobile)' started by enonod, Apr 28, 2008.

  1. enonod

    enonod Well-Known Member Licensed User

    I replied twice to a post and so it probably got missed (Form size 264h).
    I tried the Formlib answer but the desktop emulator for PPC jumped to full screen and thus top left corner. I put the object (dll) as for both desktop and PPC because it didn't seem to work with only PPC.
    It gave the message object reference not set to an instance of an object.

    Sub App_Start
    End sub

    I realise I have omitted to replace some placeholder but don't understand B4PObject(1)

    A second question if I may...
    Sprite.value (I read the help but) something escapes me about value.
    Thank you
  2. agraham

    agraham Expert Licensed User

    FullScreen only works properly on the device. The compiler needs the dll on both desktop and device. This is why some libraries that only work on the device have a dummy desktop version.

    B4pObject(1) is a reference to the form that the FormLib is to be associated with. See below.

    Sprite.Value is a reference to a Sprite object. You can't use references within B4PPC but you can pass them to and from libraries that understand them. A reference identifies an particular object, in this case a particular sprite. For example GameWindow.Sprite1 holds a reference to one of the sprites involved in a collision. You can assign this reference to a Sprite object and so manipulate that particular sprite. This avoids having to write code for each and every individual Sprite that you create.
  3. enonod

    enonod Well-Known Member Licensed User

    Thank you for that explanation. I realise that full screen is only meant for the PPC but it was the PPC emulator on the desktop screen that was going full screen instead of the toolbars disappearing.
    I seem to have problems with example code because they tend to use references that are in fact able to be varied by the user but the example seems to use the actual key word, which then makes it ambiguous to me.
    i.e. fred could be a sprite, hence fred.value makes sense to me but...
    Sprite.value does not because it is now uncertain whether 'Sprite' is a generic term and could be any name or whether 'Sprite' must actually be used as such.
    This is because it appears that Sprite1 must be used as Sprite1 because it is a system reference retained as one of the colliding sprites.
    I don't think that is very clear but maybe you are smart enough to untangle what I am trying to say.

    The example sprite program uses Sprite.New1 & Spr1.New1 & Spr2.New1 'These sprites will be used in the collision events.
    I can't make out whether 'Sprite.New1' MUST be used or could it have been fred.New1???
    Sorry to be so thick
  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Fred, Burt, Harry or whatever you want can be used but you must make sure to create an object with the same name. This can be done either using code or via the Tools>Add Object menu.

  5. enonod

    enonod Well-Known Member Licensed User

    My thanks.
  6. agraham

    agraham Expert Licensed User

    A Basic4PPC library contains object types, such as Sprite, which from which you create named instances of objects of that type.

    "Sprite", or any other type name from a library, is never used as a generic name (with one exception - as a parameter to AddObject). Once an object is created, either at design time, or at runtime by AddObject, it must be instantiated (initialised) by calling one of its' NewX methods. There is nothing to stop you creating a Sprite object named "Sprite" but it could be confusing if you do. The examples use "Sprite" as the name to show the type of object, in use you replace this with your own name. This is a common convention in Basic4PPC documentation.

    The Sprite1 and Sprite2 properties of a GameWindow are not Sprite objects but are properties returning a reference to a Sprite object.

    You can call it whatever you want. The example sprite program uses Sprite.New1 & Spr1.New1 & Spr2.New1 to create "empty" Sprite objects . Their Value property will be empty until another Sprite reference is assigned to them. This means, as I said before, that you can code once using those objects then manipulate any Sprite whose reference is assigned to them.
    Last edited: Apr 28, 2008
  7. enonod

    enonod Well-Known Member Licensed User

    That is very clear and helpful, thank you very much.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice