SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Has anyone ever been able to set a tag in a window declaration?

    I'm wondering if anyone has ever been able to pass the tag in a window statement as Mr Cluey once claimed you could. As in...

    Mr Cluey wrote...
    --------------
    Instances of window classes (both predefined classes and custom classes) can be created on the fly. The syntax isn't all that common, but it may look familiar.

    window wTemp = MyWin("MyTag") ;

    wTemp now points to a MyWin with the WndTag "MyTag". In the execution of your scripts, a window defined this way is equivalent to one declared explicitly. The string passed in becomes the tag associated with this window. The special tag markers are allowed, of course. It is also permitted to create a window with no tag at all.

    window wTemp = MyWin();

    -Greg
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  2. #2
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    Nevermind. It does work and it works great. User error!

    -Greg
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    Really!? How are they delimited? Can you give an example?

    -Greg

    ------------------
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Location
    Hartford, CT, USA
    Posts
    163
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    What kind of situation would we require to declare a window and then drive it?



    ------------------
    Jaimini Bhatt
    jaiminita@hotmail.com
    jaiminita@yahoo.com
    Jaimini Bhatt

  5. #5
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    Well, Jaimini, there are probably as many methods of automating as there are people doing it. In my case, the need to declare a window and drive it is common, but I'll give one particular example.

    We have a complicated, feature-rich OCX that we develop in-house for use in some of our products. The need was to create a test harness and 4Test interface that would allow us to write .t files to test this OCX control independent of our other products. Something like this...

    By making the harness as "light-weight" as possible (it's literally just a simple MDI app where each MDI child hosts an instance of the OCX) I was able to wrap the OCX and the harness app with 4Test and drive the OCX almost as if 4Test were hosting the OCX itself. Think of the test harness app as a sort of GUI for my 4Test code.

    Now, I needed to build a collection class in 4Test that held (n) or more instances of the MDI child/OCX as a 4Test window. I had to be sure that each instance in my collection referenced a specific instance of the child form in the harness app. To do this, I built a constructor method for the window object(s) that are contained in the collection.

    This constructor allows a "New" method of the collection class to create an MDI child in the harness app, grab the child's dynamic (always unique) form caption, create a window reference and pass the caption to the constructor so the new window object in 4Test would always reference that MDI child window instance.

    In my .t files, I then write code like this...

    That Collection.New method is where the new MDI child window is invoked in the test harness app, its caption snagged, a new window object is created (with the caption passed in as the tag) and added to the collection. Gravy!

    In my above example, I take an extra step and create a temporary window that's really just a pointer to the OCX control defined in the window object. This way I don't have to type this...

    each time I want to do this...

    It also gets around the problem of 4Test not exposing the SetProperty method of a child in the collection object, but that's another story. I don't have to create the pointer, but it helps. It may sound complicated, but in reality it's very simple and quite elegant, IMHO.

    You're probably asking yourself, "Why on Earth would anyone go to all that trouble? Why not just make the test harness app do what the .t does?" My answer would be that by writing the 300 or so lines of code to do what I just described, I can leverage my existing 4Test framework that includes results logging, extensive error trapping and so forth without re-inventing the wheel. It also gives me other benefits such as the ability to add and remove individual tests without re-compiling the harness.

    My entire 4Test library has been profiled with UML and built strictly OOP. I don't have functions, per se. Everything is contained inside of a class. I have classes that wrap the UI of the AUT, "public static" classes that contain methods and so forth.

    Sure, it was more work up-front, but the end result is a solid and very easy to maintain library that acts as an abstraction layer to the .t scripts. If the AUT changes, big deal! The object interface doesn't need to change, only the member code in my classes does.

    Well, that was probably 1000% more answer than you were looking for, but there you have it. One example of why somebody might want to declare a window and then drive it "on-the-fly" so to speak. Take luck!

    ------------------
    Greg
    ATX II, LLC
    You wrote what in 4Test?!?
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    And the passed parameters to this constructor are not limited to just tags either. You can pass in whatever instance-specific values you need to set other class-defined variables.


    John


    ------------------

  7. #7
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by jaiminita:
    What kind of situation would we require to declare a window and then drive it?
    <HR></BLOCKQUOTE>

    The situation that best fits using runtime created instances (of objects like windows, dialogs, controls) is the case where your AUT supports a larger number of instances than you reasonably want to define statically with record/declarations.


    John



    ------------------

  8. #8
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    Leave it to one of the gurus to take my long-winded explanation and summarize it a single sentence! &lt;g&gt;

    ------------------
    Greg
    ATX II, LLC
    You wrote what in 4Test?!?

    [This message has been edited by gmajor (edited 02-28-2003).]
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  9. #9
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by gmajor:
    Leave it to one of the gurus to take my long-winded explanation and summarize it a single sentence! &lt;g&gt;

    <HR></BLOCKQUOTE>

    LOL! Actually if that was adequate (I doubt it was for less experienced users), then maybe I can just answer your question with:

    Because constructor is just a function call, you can pass to it any parameters you want and use them to set instance specific variables.

    Otherwise I'm working up some sample code...



    John


    ------------------

  10. #10
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Has anyone ever been able to set a tag in a window declaration?

    John,

    That makes sense. So there's a "hidden" constructor that takes arguments for Tag (as we've seen) and, from what you're saying, other values as well. I'm just curious what the argument syntax is. I mean, is it something like this...

    If so, what's the argument syntax for the constructor?

    ------------------
    Greg
    ATX II, LLC
    You wrote what in 4Test?!?
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

 

 
Page 1 of 2 12 LastLast

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:11 AM.

Copyright BetaSoft Inc.