View Full Version : Really need help with referencing tables.
longedge
06-07-2004, 04:05 PM
I've been building a slider to control audio volume and I thought that I could use a whole series of hotspots and then control both an image position (like a little cursor) and also the volume by using HotSpot.GetPos in the 'On Enter' event of each hot spot.
I just cannot get my head round referencing the table returned by the action. I always get a Type(Nil). Has anybody got a VERY simple example that I can look at.
I'm sure I understand the concept of tables/arrays (great tutorial Corey wish I'd got you for some voice overs :) ) but where I am falling down is in accessing the HotSpot.GetPos data.
I've actually done what I wanted by hard coding x,y positions and volume levels and it all works, but I need to know where I'm going wrong for the sake of my sanity.
longedge
06-08-2004, 06:11 AM
for instance what is wrong here, shouldn't the variables pos_x and pos_y be assigned the x,y co-ordinates of the button when the event fires? They remain of type 'Nil' so I'm obviously way off mark :huh
button_pos = Button.GetPos("Button1");
pos_x=button_pos[x];
pos_y=button_pos[y];
You need to use button_pos.X and button_pos.Y
GetPos returns an Associative table. You reference the table elements by using the associated name.
for instance what is wrong here, shouldn't the variables pos_x and pos_y be assigned the x,y co-ordinates of the button when the event fires? They remain of type 'Nil' so I'm obviously way off mark :huh
button_pos = Button.GetPos("Button1");
pos_x=button_pos[x];
pos_y=button_pos[y];
csd214
06-08-2004, 09:07 AM
Tables in AMS can be a pain, but how useful they are when you can handle them! I have spent a lot of hours to be a friend with “tables and arrays”; this is indeed essential when working with AMS. It was a relief to read a post from Worm (last year), even that guy had a question about tables.
Don’t misunderstand, Worm, it’s meant to be a compliment! At the time being I’m archiving your DLLs in \Gallery\DWL (“Dynamic Worms Library” – as proposed by Intrigued). I have to create a small .chm to have an overview of your DLLs. Your KEYSTROKE.DLL is incredible, thanks a lot. :yes
Thanks csd214, I'll accept an accolade in any form :)
It took me a bit to get my head wrapped around the tables in AMS that is for sure. I'm still learning about them too. Once I think I have something locked down, I see a post from someone else that has done the same thing I'm doing, but they did it in half the steps and with much more clarity.
As for the KeyStroke.DLL, the credit should go to William Burns from the PowerBASIC forums. He wrote the include file for PowerBASIC, I merely made a DLL that wraps the functionality for use in AMS.
Tables in AMS can be a pain, but how useful they are when you can handle them! I have spent a lot of hours to be a friend with “tables and arrays”; this is indeed essential when working with AMS. It was a relief to read a post from Worm (last year), even that guy had a question about tables.
Don’t misunderstand, Worm, it’s meant to be a compliment! At the time being I’m archiving your DLLs in \Gallery\DWL (“Dynamic Worms Library” – as proposed by Intrigued). I have to create a small .chm to have an overview of your DLLs. Your KEYSTROKE.DLL is incredible, thanks a lot. :yes
Intrigued
06-08-2004, 10:35 AM
Don't tell I.R. representatives (*wink), but I would probable pay a small fee to access this forum! However, I believe this forum is an excellent selling point as is; that I.R. or their clients/customers can share with others who are looking for an application such as AMS and that which has excellent, free, quick forum help!
I have been active in the AMS forum for a short period (six months approximately) and I find that when adding the 'human element' combined with real-time solutions here in the forum it is the strong 'right-cross' to the two manual's 'left-jab' that makes AMS a one-two punch on my projects that make them much more professional and more quickly available to distribute! (and don't forget those Speedy Training CD-ROMS by Corey!)
Worm's contributions (and other front runners here like, TJ, Corey, Brett, Adam, Lorne, and others) surely add that dynamic that applications for sale need in order to shine above the rest in the market segment they occupy, in my opinion.
longedge
06-08-2004, 12:21 PM
this forum is an excellent selling point
Certainly made the buying decision easy for me. I'm sure that 'guests' just popping in for a 'look see' can't fail to be impressed at this level of support from IR staff and users alike.
Obviously the software is great but the forum is the 'icing on the cake' for me - now then what was it I was going to try - oh yes .x NOT [x] - let's give it another go.... one day soon I hope I'll have one of those moments when it all becomes clear to me.
longedge
06-08-2004, 01:20 PM
Ahhhh grasshopper x<>X and neither does y=Y :yes
Now to try and work out why a button with attributes of -
Left-200 Top -300
Width-200 Height-50 returns values of 720 - X and 558 -y
but that will do for another day - many thanks Worm.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.