SPONSORS:






User Tag List

Results 1 to 9 of 9
  1. #1
    Guest

    Type Casting a WINDOW to a STRING?

    PROBLEM:
    I have a list of WINDOW objects that I would like to minupulate as type STRING.

    WINDOW wResults = DBFindCandidates.BCFindCandidates.Results
    wResult --> STRING?

    IDEAS:
    I thought of writing the WINDOW object to a file, then reading it back into a LSIT OF STRING. However, I can't write the WINDOW variable to a file since it isn't of type STRING. There are several problems that I have that I would like to write a list of WINDOW variables to a file.

    How can I convert a WINDOW to a STRING?

    RULED OUT:
    I know I could do something like:

    STRING sResult = DBFindCandidates.BCFindCandidates.Results
    @sResults.Click()

    Basically, convert a STRING to a WINDOW. However, I am using a function to get a listing of all objects on a page. The only way I can get these is by type WINDOW. I know need to convert the WINDOW type to a STRING.



  2. #2
    Junior Member
    Join Date
    Aug 1999
    Location
    Tucker GA USA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    If you are interested in converting Window Names to strings, have you considered the WindowName () function.

  3. #3
    Junior Member
    Join Date
    May 2002
    Location
    France
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    You may also directly use this:

    window wWin
    string sWin="{wWin}"

    ...carefull however since the casting will be limited to a max of 255 char

  4. #4
    Junior Member
    Join Date
    Jul 2003
    Location
    San Francisco
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    STRING sResult = [STRING]DBFindCandidates.BCFindCandidates.Results
    @sResults.Click()

    or as Rascal defined it above. It's six of one, half dozen of the other.
    Sean McCabe
    Paithan Group Consulting
    seanm@paithangroup.com

  5. #5
    Senior Member
    Join Date
    Dec 2001
    Location
    Bozeman, MT, USA
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    in my experience you cannot typecast WINDOW datatypes. You also cant use the @ when you have a period in the string.

    string sWin="{wWin}" should work.
    Ryan McCullough
    RightNow Tech. Inc.

  6. #6
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    WOW - is this message still around - I must have posted that ages ago! Not sure why it list me as "unregistered" though - i am user #5 i think!

    Anyway, this was solved ages ago, here is the answer:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[+] WINDOW Str2Win (STRING s)
    [-] // @HELP
    [ ] // @group: Utility Functions
    [ ] // @function: wWindow = Str2Win(s)
    [ ] // @returns: wWindow: Returns the passed string as a window object
    [ ] // @parameter: s: The string to convert
    [ ] // @notes: Converts a strign to a window data type
    [ ] //
    [ ] // @END
    [ ] INTEGER i = 1
    [ ] STRING sSubWin = GetField (s, &quot;.&quot;, i)
    [ ] WINDOW w = @sSubWin
    [ ]
    [-] while TRUE
    [ ] i++
    [ ] sSubWin = GetField (s, &quot;.&quot;, i)
    [-] if sSubWin == &quot;&quot;
    [ ] return w
    [-] else
    [ ] w = w.@sSubWin
    [ ]
    [+] STRING Win2Str (WINDOW w)
    [+] // @HELP
    [ ] // @group: Utility Functions
    [ ] // @function: sString = Win2Str(w)
    [ ] // @returns: sString: Returns the passed window as a string
    [ ] // @parameter: w: Window object to convert to a string
    [ ] // @notes: Converts a window datatype to a string
    [ ] //
    [ ] // @END
    [ ] STRING sSubWin, sWin = [STRING]w
    [ ] INTEGER i = 1
    [ ] STRING sVar = GetField (sWin, &quot;.&quot;, i)
    [ ]
    [-] while (TRUE)
    [ ] i++
    [ ] sSubWin = GetField (sWin, &quot;.&quot;, i)
    [-] if sSubWin == &quot;&quot;
    [ ] return sVar
    [+] else
    [ ] sVar = sVar + &quot;.&quot; + sSubWin
    [ ]
    [ ] </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Enjoy,

  7. #7
    Member
    Join Date
    Aug 2003
    Location
    nantes
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    Hi!
    I tried your prgm David but I've got this f... error message :
    *** Error: Variable {FORMATION.ProClientWin1.MiseÓJourDesClients.ProFr ame1.TextField2 is not defined

    In fact, it says me that my window is not defined !!!
    I'm a beginner, and I do not understand.
    Please
    Thanks & Regards
    Arnaud.

  8. #8
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    Take a very close (even character by character) look at your Window Declaration and compare it to that error message, as well as the specific line in your code that is making the call when the error occurs. If you enclose your code in a do/except, and make a call to ExceptLog() in your except, you will get the specific line number where the exception was thrown and other information that will help you narrow down the problem.

  9. #9
    Junior Member
    Join Date
    May 2002
    Location
    France
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Type Casting a WINDOW to a STRING?

    Just a quick comment on that piece of code:it does not solve the 255 character limitation you get when casting your window into string, therefore it won't work if your window declaration is more than 255 characters long...(happends with Java applet with multiple frames(or with very long retrieved tags...)

    ...By the way David:Congratulations for your "SILK Help Generator", i use it regularly and i really like the design of it (just a quick bug however ;-)...it doesn't work if you create 2 groups with matching part names, like "my_Group" and "my_Group4test"...yet it's really handy! ))

 

 

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 10:39 PM.

Copyright BetaSoft Inc.