Sign in to follow this  
Followers 0
Delta

Real Size Image

12 posts in this topic

Hi im working on a small app to display images when a user clicks a button the image changes to what ever button its associated with. all the images are different sizes greater then 800x600 and the image shrinks when i select it. i'm usuing koda form designer and i tried usuing $SS_REALSIZEIMAGE but i get an error that variable is undefined. how do i define it or is there another method i could use?


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites



Hi im working on a small app to display images when a user clicks a button the image changes to what ever button its associated with. all the images are different sizes greater then 800x600 and the image shrinks when i select it. i'm usuing koda form designer and i tried usuing $SS_REALSIZEIMAGE but i get an error that variable is undefined. how do i define it or is there another method i could use?

think you forgot to post the code you have a problem with .... :whistle:

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

$SS_REALSIZEIMAGE is the code im having a problem with. when i use it it gives me an undefined variable.

$map = GUICtrlCreatePic("", 128, 24, 520, 360, BitOR($SS_REALSIZEIMAGE,$WS_HSCROLL,$WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$SS_REALSIZEIMAGE is the code im having a problem with. when i use it it gives me an undefined variable.

$map = GUICtrlCreatePic("", 128, 24, 520, 360, BitOR($SS_REALSIZEIMAGE,$WS_HSCROLL,$WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))

I don't see that as a standard style myself...where did you get that from?

Put this at the top of your script.

Global Const $SS_REALSIZEIMAGE = 0x0800

Edit:

Had the wrong value :whistle:

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

where did you get that from?

i'm usuing koda form designer

Also 'Global Const $SS_REALSIZEIMAGE = 0x0800' Removed the error but it didn't make the image actual size, it still shrank it.


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

would it help if i posted every last bit of code?

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\c2d\autoit\silkroad map\silkroadmap.kxf
$silkroadmap = GUICreate("Silkroad Map", 651, 451, 190, 113)
$map = GUICtrlCreatePic("data/world.bmp", 128, 24, 520, 360, BitOR($SS_REALSIZEIMAGE, $WS_HSCROLL,$WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$China = GUICtrlCreateLabel("China", 0, 24, 50, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$WesternChina = GUICtrlCreateLabel("Western China", 0, 96, 122, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x808000)
$OasisKingdom = GUICtrlCreateLabel("Oasis Kingdom", 0, 168, 123, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$TaklaMakan = GUICtrlCreateLabel("Takla Makan", 0, 240, 105, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008000)
$Jangan = GUICtrlCreateButton("Jangan", 0, 48, 121, 17, 0)
$ChinaButton = GUICtrlCreateButton("China", 0, 72, 121, 17, 0)
$Donwhang = GUICtrlCreateButton("Donwhang", 0, 120, 121, 17, 0)
$WesternChinaButton = GUICtrlCreateButton("Western China", 0, 144, 121, 17, 0)
$Hotan = GUICtrlCreateButton("Hotan", 0, 192, 121, 17, 0)
$OasisKingdomButton = GUICtrlCreateButton("Oasis Kingdom ", 0, 216, 121, 17, 0)
$TaklaMankanButton = GUICtrlCreateButton("Takla Mankan", 0, 264, 121, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $Jangan
            GUICtrlSetImage($map, "data/jangan.bmp")
        Case $nMsg = $ChinaButton
            GUICtrlSetImage($map, "data/china.bmp")
        Case $nMsg = $Donwhang
            GUICtrlSetImage($map, "data/donwhang.bmp")
        Case $nMsg = $WesternChinaButton
            GUICtrlSetImage($map, "data/westernchina.bmp")
        Case $nMsg = $Hotan
            GUICtrlSetImage($map, "data/hotan.bmp")
        Case $nMsg = $OasisKingdomButton
            GUICtrlSetImage($map, "data/oasiskingdom.bmp")
        Case $nMsg = $TaklaMankanButton
            GUICtrlSetImage($map, "data/taklamakan.bmp")
        Case Else
    EndSelect
WEnd

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

try this and let me know if it works for you. not sure why i decided to write the whole code for ya, but since i used to play the game and wrote a pricing program for it with autoit i guess there was an attachment to it :whistle:

any further questions feel free to holler.

#include <GUIConstants.au3>
#include <File.au3>
#include <IE.au3>

$worldmap = _TempFile()
$Janganmap = _TempFile()
$Chinamap = _TempFile()
$Donwhangmap = _TempFile()
$WesternChinamap = _TempFile()
$Hotanmap = _TempFile()
$OasisKingdommap = _TempFile()
$TaklaMankanmap = _TempFile()

FileInstall("data\world.bmp", $worldmap)
FileInstall("data\jangan.bmp", $Janganmap)
FileInstall("data\china.bmp", $Chinamap)
FileInstall("data\donwhang.bmp", $Donwhangmap)
FileInstall("data\westernchina.bmp", $WesternChinamap)
FileInstall("data\hotan.bmp", $Hotanmap)
FileInstall("data\oasiskingdom.bmp", $OasisKingdommap)
FileInstall("data\taklamakan.bmp", $TaklaMankanmap)

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

$gui = GUICreate("Silkroad Map", 651, 451, _
190,113, $WS_POPUP + $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS,$WS_EX_TOPMOST)

$GUIActiveX = GUICtrlCreateObj($oIE, 128, 24, 520, 360)
GUICtrlSetResizing($GUIActiveX, $GUI_DOCKBORDERS)

$China = GUICtrlCreateLabel("China", 0, 24, 123, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$WesternChina = GUICtrlCreateLabel("Western China", 0, 96, 123, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x808000)
$OasisKingdom = GUICtrlCreateLabel("Oasis Kingdom", 0, 168, 123, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$TaklaMakan = GUICtrlCreateLabel("Takla Makan", 0, 240, 123, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008000)
$JanganButton = GUICtrlCreateButton("Jangan", 0, 48, 121, 17, 0)
$ChinaButton = GUICtrlCreateButton("China", 0, 72, 121, 17, 0)
$DonwhangButton = GUICtrlCreateButton("Donwhang", 0, 120, 121, 17, 0)
$WesternChinaButton = GUICtrlCreateButton("Western China", 0, 144, 121, 17, 0)
$HotanButton = GUICtrlCreateButton("Hotan", 0, 192, 121, 17, 0)
$OasisKingdomButton = GUICtrlCreateButton("Oasis Kingdom ", 0, 216, 121, 17, 0)
$TaklaMankanButton = GUICtrlCreateButton("Takla Mankan", 0, 264, 121, 17, 0)
GUISetState(@SW_SHOW)

_IENavigate ($oIE, $worldmap) ;navigate to the first image

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            _cleanup() ;delete the temp files before closing
            Exit            
        Case $nMsg = $JanganButton
            _IENavigate ($oIE, $Janganmap)
        Case $nMsg = $ChinaButton
            _IENavigate ($oIE, $Chinamap)
        Case $nMsg = $DonwhangButton
            _IENavigate ($oIE, $Donwhangmap)
        Case $nMsg = $WesternChinaButton
           _IENavigate ($oIE, $WesternChinamap)
        Case $nMsg = $HotanButton
            _IENavigate ($oIE, $Hotanmap)
        Case $nMsg = $OasisKingdomButton
            _IENavigate ($oIE, $OasisKingdommap)
        Case $nMsg = $TaklaMankanButton
            _IENavigate ($oIE, $TaklaMankanmap)
        
    EndSelect
WEnd

Func _cleanup()
    
    FileDelete($worldmap)
    FileDelete($Janganmap)
    FileDelete($Chinamap)
    FileDelete($Donwhangmap)
    FileDelete($WesternChinamap)
    FileDelete($Hotanmap)
    FileDelete($OasisKingdommap)
    FileDelete($TaklaMankanmap)
    
EndFunc

Share this post


Link to post
Share on other sites

Thanks for the reply the reply how ever all that code does is open up the first image in MSpaint, none of the buttons work, and the program wont exit. i'm happy however that someone replied.


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thanks for the reply the reply how ever all that code does is open up the first image in MSpaint, none of the buttons work, and the program wont exit. i'm happy however that someone replied.

since i didnt have the image files i was using my own sorry and they were jpg and gif. not sure why you were using bmp image files, convert them to jpg and then change your file install lines to direct it to the exact location per my example below and try again. let me know. not sure what you mean by the program won't exit, do you mean when you press the x in the upper right corner if won't? works fine on my end using the latest beta.

tim

*edit* upon further review, it appears file associations have alot to do with this. even changing bmp files to open in internet explorer does not work. if you change like i recommend then all should be well in the world :whistle:

FileInstall("C:\AutoIt3\supertemp\data\world.jpg", $worldmap)
FileInstall("C:\AutoIt3\supertemp\data\jangan.jpg", $Janganmap)
FileInstall("C:\AutoIt3\supertemp\data\china.jpg", $Chinamap)
Edited by saturnknts

Share this post


Link to post
Share on other sites

Now it works perfectly thank you so much. one last tiny question is it possible to get rid of the white space between the image and the edge?


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

Now it works perfectly thank you so much. one last tiny question is it possible to get rid of the white space between the image and the edge?

not experienced enough to give you a solution for that, maybe one of the IE guru's have the answer sorry.

btw i did notice something, if the user resizes your gui to maximum then the labels overlap the obj. so in order to fix it you need to set the GUICtrlSetResizing(-1, $GUI_DOCKSIZE) for each label and you will see they don't over lap anymore. or you can copy paste the below over your coding. used a func so be sure and copy paste it to the bottom of your coding as well to set both resize and font. good luck.

lastly, where are you going to post this up, i'd like to download the final product just for grins.

tim

$China = GUICtrlCreateLabel("China", 0, 24, 123, 24)
GUICtrlSetColor(-1, 0xFF0000)
_size()
$WesternChina = GUICtrlCreateLabel("Western China", 0, 96, 123, 24)
GUICtrlSetColor(-1, 0x808000)
_size()
$OasisKingdom = GUICtrlCreateLabel("Oasis Kingdom", 0, 168, 123, 24)
GUICtrlSetColor(-1, 0x0000FF)
_size()
$TaklaMakan = GUICtrlCreateLabel("Takla Makan", 0, 240, 123, 24)
GUICtrlSetColor(-1, 0x008000)
_size()
oÝ÷ Ù«­¢+Ø)Õ¹}Í¥é ¤(%U%
ÑɱMѽ¹Ð ´Ä°ÄÈ°àÀÀ°Ð°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤(%U%
ÑɱMÑIͥ饹 ´Ä°ÀÌØíU%}=
-M%i¤)¹Õ¹(

Share this post


Link to post
Share on other sites

Yea actually i removed the colors and i set the gui so that it can't be resized. Maybe in the future i will make it available for resizing but right now I'm focusing on something else.

here's a direct link to the installer so you don't have to sign up with the site to get it.

http://user.goc2dclan.com/delta/SilkroadMA...0_Installer.exe

I actually need to fix the installer on the next update so that it shows that i got help from you and that i got the map images right off the Silkroad website.


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0