EQ2Interface.com
Search Downloads


Go Back   EQ2Interface > Developer Discussion > UI Developer Discussion

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 10-08-2010, 10:45 PM
kdmorse kdmorse is offline
A Young Mystail Rat
 
Join Date: Jan 2005
Server: Antonia Bayle
Posts: 7
Default String Compare?

Is it possible to do primitive string compares at all? I seem to be drawing a blank.

Really, I'm looking for the logical equivalent of:

if Parent.Text5.Text == "" then
Parent.Temp = Parent.Input5.Text
else Parent.Temp = Parent.Text5.Text

Based on some things I've seen, I'm fumbling around with
Parent.Temp = Parent.Text5.Text eq '' ? Parent.Input5.Text : Parent.Text5.Text

Doesn't work of course, but that's what I'm aiming for. If one box has text in it, use that text. If not, use a different box....

Elsewhere, I'd love a 'Begins' type text compare. So I can compare the beginning of the string, but not the entire string (as the tail end changes) - but I suspect that's impossible with the tools at hand...

Thanks,

-Ken
Reply With Quote
  #2  
Unread 10-08-2010, 11:27 PM
EQAditu's Avatar
EQAditu EQAditu is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Permafrost
Posts: 256
Default

Normally you can only do one evaluation per line, so try the following:

ISEMPTY=Parent.Text5.Text==''
Parent.Temp=ISEMPTY ? Parent.Input5.Text : Parent.Text5.Text


Or you can try to wrap the encoded apostrophes with parenthesis: ('')
I've never had great luck with comparing null strings but maybe one of those will work. Putting a null string into a variable and trying to compare with that variable doesn't work because the engine sees that no variable with a value exists by that name, so it treats the variable name as plain text.


We don't have any ability to do substring operations except for things like "123,456" put into a Location property of a Widget can be split by the comma by referencing the Left and Top properties.
Reply With Quote
  #3  
Unread 10-11-2010, 03:24 PM
kdmorse kdmorse is offline
A Young Mystail Rat
 
Join Date: Jan 2005
Server: Antonia Bayle
Posts: 7
Default

Thanks - I think you're example, and comments are enough to help me get what I want done, even if it's in a slightly more convoluted way than expected.

Unfortunately, I just haven't had the time to get back to it and try it out. But I wanted to make sure I responded and thanked you for the help.

Thanks,

-Ken
Reply With Quote
  #4  
Unread 10-11-2010, 05:04 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Quote:
Originally Posted by EQAditu View Post
I've never had great luck with comparing null strings but maybe one of those will work. Putting a null string into a variable and trying to compare with that variable doesn't work because the engine sees that no variable with a value exists by that name, so it treats the variable name as plain text.
You can also make a helper attribute for that like empty="" onPress="ISEMPTY=Parent.Text5.Text==empty", that often helps around such issues.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #5  
Unread 10-11-2010, 07:48 PM
EQAditu's Avatar
EQAditu EQAditu is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Permafrost
Posts: 256
Default

If you say so, but the exact thing you quoted meant that I had no such luck with it. If I make an XML attribute with nothing in it, the engine treats the referenced attribute as plain text instead of a variable. I ended up making it " " (a space) instead of "" and it worked fine... so I left it like that.
Reply With Quote
  #6  
Unread 10-12-2010, 03:01 AM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Quote:
Originally Posted by EQAditu View Post
If you say so, but the exact thing you quoted meant that I had no such luck with it. If I make an XML attribute with nothing in it, the engine treats the referenced attribute as plain text instead of a variable. I ended up making it " " (a space) instead of "" and it worked fine... so I left it like that.
Fair enough, I know I used a space when dynamically doing it, too, am probably misremembering the attribute thing then.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:01 PM.


Our Network
EQInterface | EQ2Interface | WoWInterface | LoTROInterface | ESOUI | MMOUI