mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
getting name of window using a hash table with ... #193110 15/01/08 03:56 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
How do you get a name of a window with hash table data with multiple names....

like
hash table -- GUI

data
-@blah
-@boom
...etc...

just ask if you dont understand(I'm making a GUI)


This is not the signature you are looking for
Re: getting name of window using a hash table with ... [Re: foshizzle] #193113 15/01/08 05:18 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
the name of any window? or a specific one? If you know the name of it, then.. well, you already have it. If you want the "first" window in your hash table, though-- you can't do that.

Your question is quite vague so I'll go over all the ways to get values from hash tables.

Hash tables don't maintain order, they're a data structure similar to your english dictionary. You have a "key" (the english word) and the corresponding "value" (the definition of the word).. you do lookups by the key name, not by the index number. For instance, because you don't (easily) know how many words are between "aardvark" and "arrow", you can't just say "give me the next word", because there is no simple correlation between one key and the next. They're not maintained that way in memory, so its your job to figure out the next key.

If you want to maintain order in a hash table, make the key a number value ranging from 1-n and then have the value contain the rest of the data.

You can also use $hget(htable,N) where N is a value from 1-size. In this case, mIRC will grab the "Nth" key-- but before you go AHA!, know that the order is not guaranteed. It might pull "arrow" at index 1 and "aardvark" at index 2, for instance. Even though you may have entered them in the other way around.

Finally, you can use $hfind to search for a key name if you know part of the name, like "@b*".. again these results are not ordered, but this might be what you're looking for.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: getting name of window using a hash table with ... [Re: argv0] #193150 15/01/08 03:41 PM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
if you have ever used the Blizzard GUI from picwin.tk, thats what im talking about, I want it because for mouse events you need a specified window... altough there might be a way... thx for that anyway

what i will try, and i hope it works, is i will create an if statement inside my general code for a highlight and i will create mouse events for a check on the active window(if the hash table name matches the window name)


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193180 15/01/08 10:20 PM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Does this work?
Code:
menu $active {
  sclick:if ($active == $hfind(GUI,$active) { window -c $active }
}

and if not, how do i get it to


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193181 15/01/08 11:08 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try it yourself you lazy git, then come back and ask for help if it doesn't work.

Re: getting name of window using a hash table with [Re: foshizzle] #193191 16/01/08 01:45 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As mentioned, try things first... then ask if it doesn't work. It saves everyone some time. smile

That said, you're missing a ), so it will not work. And I'm not entirely sure that you're going to get a good comparison in that IF... it will depend on how your hash table is configured. Just try it and see if it works (after adding your missing ) ).


Invision Support
#Invision on irc.irchighway.net
Re: getting name of window using a hash table with [Re: Riamus2] #193197 16/01/08 02:51 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i did try it


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193198 16/01/08 03:05 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400
  hmake @GUI
  hadd @GUI name @GUI
}
menu $active {
  sclick: { if ($active == $hfind(GUI,$active) == name) { window -c $active } }
}

heres what i have, i think the hash tables are wrong, can someone fix it please? i just learned them lol

Last edited by foshizzle; 16/01/08 03:05 AM.

This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193206 16/01/08 03:41 AM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
you hmade @GUI, not GUI.

Re: getting name of window using a hash table with [Re: Bekar] #193210 16/01/08 04:18 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400
  $iif($hget(@GUI), hfree @GUI, )
  hmake @GUI
}
menu $active {
  sclick: { if ($hget($active) == $active) { window -c $active } }
}

still doesnt work...


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193212 16/01/08 04:34 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
you can't do "menu $active"

$active is meaningless at that level of code

Why would you have the $iif over a regular if statement by the way?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: getting name of window using a hash table with [Re: argv0] #193218 16/01/08 01:45 PM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
idk
do u know how i would get this to work though?


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193224 16/01/08 06:55 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
As I said, menu $active is meaningless.. Follow the proper syntax, type /help menu prefix


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: getting name of window using a hash table with [Re: argv0] #193236 17/01/08 02:25 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i knwo it but how


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193237 17/01/08 02:47 AM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Use the /window command's ability to use a defined Popup menu:

Code:
alias GUI { 
  window -pkodCfB +b @GUI -1 -1 400 400 @MyPopup
  if ($hget(@GUI)) { hfree @GUI }
  hmake @GUI
  hadd @GUI name @GUI
}
menu @MyPopup {
  sclick: {
    if ($active == $hget(@GUI,name)) {
      window -c $active
    }
  }
}

Something like that perhaps.. although the point of the hash table at this point is.. well, there isn't a point.

Re: getting name of window using a hash table with [Re: Bekar] #193238 17/01/08 03:36 AM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
i know, with that, but i want this to be a GUI, so i need multiple windows.. thus requiring some way to tell if a window is a GUI window....


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193241 17/01/08 04:43 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
but you see, you know its a GUI window because you made the menu specifically for that window name

"menu @MyPopup {"

AFAIK, you cannot make a menu for an arbitrary custom window, so you will always know the menu you made is for a specific window. This goes back to how i said "menu $active" is meaningless, and that you should consult /help menu prefix


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: getting name of window using a hash table with [Re: argv0] #193257 17/01/08 03:43 PM
Joined: Aug 2007
Posts: 334
foshizzle Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
I know that, but do u know any way around it?


This is not the signature you are looking for
Re: getting name of window using a hash table with [Re: foshizzle] #193260 17/01/08 03:52 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try something like this...

Code:
menu * {
  $iif(@* iswm $window($active),GUI):Do something here
}


If you need the menu to only work for custom windows starting with "@GUI", then put "@GUI*" instead of "@*".

Granted, that doesn't give sclick ability, but you may be able to work around needing that depending what you're doing.


Invision Support
#Invision on irc.irchighway.net
Re: getting name of window using a hash table with [Re: Riamus2] #193262 17/01/08 05:31 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Small sidenote, $window($active) is the same as $active (as the latter always returns the name of an existing window (or $null, although that wouldn't happen in popups)).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Page 1 of 3 1 2 3