Results 1 to 1 of 1

Thread: With {As|Like} vartype At- a virtual idea

  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Blog Entries
    Rep Power

    With {As|Like} vartype At- a virtual idea

    Uses "console"
           Type t_Test
             X As Long
             Y As Long
             Z As Long
             magic As Function
           End Type
           Function t_Test.magic() As Long
            Function = Pow(Me.x+Me.y,Me.z)+(Me.z+Me.y*Me.x)*Me.z*(Me.y -Me.x)
           End Function
           DWord pData = HEAP_Alloc(SizeOf(t_Test))
           With As t_Test At pData
             .X = 1
             .Y = 2
             .Z = 3
             PrintL .magic
           End With
    PrintL $CRLF & "                  --- any key to end ---"
    sorry i wish it would run

    the idea is to use With As ... [At ...] so might need steps for understanding to reach the syntax above:

    'just use "With" and instant layover in one go:
    With [Local win] As cWindow At Dialog_GetUser(CBHNDL,1)
      .SetText("I'm a new caption at the current calling window")
      .Refresh() ' *** redraw is keyword already
              '           :( why cant this be differentiated...
    End With

    now got the idea? Great were if this were possible too:

    With Like "cWindow" At Dialog_GetUser(CBHNDL,1)
    it should be possible to use more than 1 "With As ... At ..." inside a function and allow usage of different types in different executions of the same function when "With Like ... At ..."

    perhaps in general the At is not even mandatory
    - we could create a "real local variable" of some udt also this way and instantly use its properties & functions - until End With follows
    (in case we need to name the variable somehow then it could stay valid until exit funcion)
    Last edited by ReneMiner; 30-01-2015 at 23:30.
    maybe no PC currently but always a head full of ideas

Similar Threads

  1. passing virtual type ByPtr?
    By ReneMiner in forum Core module
    Replies: 4
    Last Post: 27-05-2013, 07:35
  2. interesting demo of a 3D virtual world
    By zak in forum Shout Box Area
    Replies: 7
    Last Post: 15-07-2011, 13:57
  3. Here's a working virtual listview script
    By martin in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 12
    Last Post: 09-09-2009, 19:12
  4. Microsoft Virtual PC 2007 SP1
    By ErosOlmi in forum Technology
    Replies: 3
    Last Post: 22-05-2008, 00:02
  5. Need to develop in Linux, need virtual stuff
    By Michael Hartlef in forum Shout Box Area
    Replies: 6
    Last Post: 12-03-2008, 00:47

Posting Permissions

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