| View previous topic :: View next topic |
| Author |
Message |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Sun Apr 21, 2002 7:52 pm Post subject: VDSElm Skipping Code |
|
|
Hopefully I can make enough sense here to get some help..
I'm using VDSElm for an image preview.
I have IMAGE1 set for no width and height so that it adjusts to the size of the image I set. I also have IMAGE2 set to a width and height I want and using the STRETCH Style.
I'm keeping IMAGE2 hidden and checking the size of IMAGE1 after an image is set, if the size of the image is bigger than I want, I hide IMAGE1 and Show IMAGE2. I figured this would work..but it's skipping the IF statement and the info test1 in the code below.
Any ideas why..or maybe another way to do what I want?
______________________________________________________________________________________________________
| Code: |
:BrowseBUTTON
if %%File
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|GIF Image (*.gif)|*.gif","Open",@PATH(%%File)*.jpg)
else
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|GIF Image (*.gif)|*.gif","Open",@SUBSTR(@WINDIR(),1,3)*.jpg)
end
if %%File
DIALOG SET,EDIT%%Page,%%File
ELEMENT HIDE,IMAGE2
ELEMENT SHOW,IMAGE1
ELEMENT SET,Image1,%%File
ELEMENT SET,Image2,%%File
if @GREATER(@ELEMENT(ELMPOS,IMAGE1,W),343)@GREATER(@ELEMENT(ELMPOS,IMAGE1,H),343)
info test1
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
info test2
end
end
goto evloop
|
When I run it, click Browse and select a picture smaller than my size limit, it shows the unstretched picture(IMAGE1) and a stretched picture behind it(IMAGE2) and gives the info test2, completly skipping at least 3 lines of code.. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Sun Apr 21, 2002 10:37 pm Post subject: |
|
|
Well I dont have VDSElm but perhaps you could try
if @GREATER(@ELEMENT(ELMPOS,IMAGE1,W),343)@GREATER(@ELEMENT(ELMPOS,IMAGE1,H),343)
info test1
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
info test2
else
ELEMENT HIDE,IMAGE2
ELEMENT SHOW,IMAGE1
end
and remove the other ELEMENT HIDE and SHOW lines outside the if block, that way it would only show one image or the other i guess |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Apr 22, 2002 2:29 am Post subject: |
|
|
I've tried that and tried making it 2 seperate IF statements, but it still skips the IF statement entirely if I select a picture smaller than 343 px wide or long. If I select a picture either longer or wider than 343 it works just fine..doesn't make much sense to me. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Apr 22, 2002 3:38 am Post subject: |
|
|
Well after much trial and error, I found that this works so far
__________________________________________________________________________________________________________________________________________________________________________
| Code: |
:BrowseBUTTON
if %%File
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|JPEG Image (*.jpeg)|*.jpeg|GIF Image (*.gif)|*.gif","Open",@PATH(%%File)*.jpg)
else
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|JPEG Image (*.jpeg)|*.jpeg|GIF Image (*.gif)|*.gif","Open",@SUBSTR(@WINDIR(),1,3)*.jpg)
end
if %%File
DIALOG SET,EDIT%%Page,%%File
ELEMENT SET,Image1,%%File
%%PosX = @ELEMENT(ELMPOS,IMAGE1,W)
%%PosY = @ELEMENT(ELMPOS,IMAGE1,H)
if @GREATER(%%PosX,343)
ELEMENT SET,Image2,%%File
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
end
if @GREATER(%%PosY,343)
ELEMENT SET,Image2,%%File
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
end
if @NOT(@GREATER(%%PosX,343))
if @NOT(@GREATER(%%PosX,343))
ELEMENT HIDE,IMAGE2
ELEMENT SHOW,IMAGE1
end
end
end
goto evloop
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Mon Apr 22, 2002 3:54 am Post subject: |
|
|
The problem is that the command ELEMENT is similar to the ELSE statement of VDS. When you use any ELEMENT commands within an IF block VDS will interpret it as ELSE which is why you are having problems. Since I no longer own the copyright to VDSELM there's nothing I can do about it, what's required is that the commadn ELEMENT is renamed to something else. VDSELEMENT would work. |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Apr 22, 2002 3:59 am Post subject: |
|
|
I remember seeing something about that but couldn't remember where. I'm sure I'll remember it now though.
Thanks _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Apr 24, 2002 4:16 pm Post subject: |
|
|
SnarlingSheep,
Just use gosub's or goto's like so...
| Code: | :BrowseBUTTON
if %%File
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|JPEG Image (*.jpeg)|*.jpeg|GIF Image (*.gif)|*.gif","Open",@PATH(%%File)*.jpg)
else
%%File = @FILEDLG("JPEG Image (*.jpg)|*.jpg|JPEG Image (*.jpeg)|*.jpeg|GIF Image (*.gif)|*.gif","Open",@SUBSTR(@WINDIR(),1,3)*.jpg)
end
if %%File
Gosub SETIMG
if @GREATER(%%PosX,343)
Gosub PosX
end
if @GREATER(%%PosY,343)
Gosub PosY
end
if @NOT(@GREATER(%%PosX,343))
if @NOT(@GREATER(%%PosX,343))
Gosub NOTXY
end
end
end
goto evloop
:SETIMG
DIALOG SET,EDIT%%Page,%%File
ELEMENT SET,Image1,%%File
%%PosX = @ELEMENT(ELMPOS,IMAGE1,W)
%%PosY = @ELEMENT(ELMPOS,IMAGE1,H)
Exit
:PosX
ELEMENT SET,Image2,%%File
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
Exit
:PosY
ELEMENT SET,Image2,%%File
ELEMENT HIDE,IMAGE1
ELEMENT SHOW,IMAGE2
Exit
:NOTXY
ELEMENT HIDE,IMAGE2
ELEMENT SHOW,IMAGE1
Exit |
I hope this helps...This is what I do to get around the problem with vdselm. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|