PDA

View Full Version : display pic corresponding to url


lucufa
02-12-2007, 08:34 PM
hey,

http://img77.imageshack.us/img77/3806/exampleamsxf6.jpg

in my app, it checks the URL using http methods and returns certain codes
if codes match (say.. 1000) it will show an image of a blue dot.. if it matches all the other codes like 3000+ it will display a red image next to the URL.

in this pic, only yahoo.com has a http value of 1000 so it displays a blue pic, all the rest display red. the user can input any URL they want, replacing those 4 URLS for it to check.. all URLs have different http values depending on this code i have, don't worry about how the http methods work just tell me what's the best way to script this.. because if they only put 1 URL sometimes it shows all 4 red dots even though i havn't specified 4 URLs but only 1..

lucufa
02-14-2007, 07:14 AM
any idea? :eek:

TJ_Tigger
02-14-2007, 09:07 AM
how are you displaying the links to the URLs and the associated images? Is this contained in a Tree object a web object?

lucufa
02-15-2007, 03:52 AM
the images are just little images, i have red and blue under each other i can hide and show whichever one i want, the links are in text boxes so they input the link and i check them using input commands. is that what you needed to know? :)

TJ_Tigger
02-15-2007, 10:24 AM
It sound like you need to add some code to the http checking code you use to show/hide the images as appropriate.

What code are you using to check the urls. We can try to help integrate the show hide if you need us to.

Tigg

lucufa
02-16-2007, 03:28 AM
The url checking is much more complicated than you can imagine, and hard to explain. The image showing/hiding i know how to do, just showing images based on how many urls are typed in the edit boxes

say. you only type 2 urls in
my app shows 4 red images, i only want them to show 2 *based on how many urls they typed* like 3 url = 3 red or blue dots.. not all 4, and it'll check to see if its red or blue.

there's also alot of if checks to check the url so it'll have like if (url_1 == <code1>) and if (url_1 == <code7>) etc. for all 4 slots.
how would i do this?

TJ_Tigger
02-16-2007, 05:09 AM
My suggestion would be to create a function that does your url checking and returns a true or false based on how everything checks out. Then I would start your red and blue images as hidden, in the properties dialog set their visible property to false. I would recommend that you have a standard naming scheme for all your items so you can loop through them, maybe something like this:

In-url1
Im-r1
Im-b1

In-url2
Im-r2
Im-b2

In-url3
Im-r3
Im-b3

In-url4
Im-r4
Im-b4

Then you can use a for loop to step through all four and perform your function

--set a loop to count from 1 to 4
for x = 1,4 do
-- get the text from the input or label that contains your url
local sURL = Input.GetText("In-url"..x)
--if it is valid or contains anything
if sURL then
--then run your custom funciton here to see if it is good, if it is then set your images appropriately
if MyURLcheckingfunction(sURL) then
Image.SetVisible("Im-b"..x, true)
Image.SetVisible("Im-r"..x, false)
else -- otherwise set them to the opposite setting.
Image.SetVisible("Im-b"..x, false)
Image.SetVisible("Im-r"..x, true)
end
else --no url in the input box then hide both images
Image.SetVisible("Im-b"..x, false)
Image.SetVisible("Im-r"..x, false)
end
end

I hope that helps get you started.