Page 1 of 1

Objects with Button images

PostPosted: Sun Dec 07, 2014 5:59 am
by NyperCro
Hello fellow Neobook'ers :)

I have a question regarding Objects who have button images.

Is it possible to change invidual images using Variables ?
Let's assume that i have Picture1,2,3 as default and user want to change set of button images to like Picture 4,5,6.
How to if possible to store that change in Variable so when program restarts selected set is used ?
Thank You

Re: Objects with Button images

PostPosted: Sun Dec 07, 2014 10:16 am
by Gaev
NyperCro:

Let's assume that i have Picture1,2,3 as default and user want to change set of button images to like Picture 4,5,6.

Take a look at the GetObjectInfo and SetObjectFileName commands e.g. ...
Code: Select all
GetObjectInfo "Picture4" "FileName" "[FileOfPic4]"
SetObjectFileName "Picture1" "![FileOfPic4]"


How to if possible to store that change in Variable so when program restarts selected set is used ?

You can use FileRead and FileWrite commands e.g. ...
Code: Select all
.. at Shutdown
FileWrite "![PubDir]Setup.txt" "1" "[FileOfPic1]"

... at Startup
FileRead "![PubDir]Setup.txt" "1" "[FileOfPic1]"
SetObjectFileName "Picture1" "![FileOfPic4]"

Re: Objects with Button images

PostPosted: Fri Dec 12, 2014 4:42 am
by NyperCro
Thank you, il will try it.
Is this possible for all 3 button images ? (Up, highlight, down) ?

Re: Objects with Button images

PostPosted: Fri Dec 12, 2014 12:34 pm
by Neosoft Support
Is this possible for all 3 button images ? (Up, highlight, down) ?


You can if you set the button to use a button library image which is a compound image containing all three (Up, highlight, down).

Re: Objects with Button images

PostPosted: Fri Dec 12, 2014 3:46 pm
by mishem
By the way about the library buttons.
You can do in the future to show the way, not only from the library?

I think it will be convenient when all the icons are stored in a folder with the publication, not in the library.

********************Rus**********************

Кстати по поводу библиотеки кнопок.
Можно в будущем сделать чтобы указывать путь не только из библиотеки?

Мне кажется удобней будет когда все значки хранятся в папке с публикацией, а не в библиотеке.

**********************************************

Re: Objects with Button images

PostPosted: Mon Dec 15, 2014 11:55 am
by Neosoft Support
You can do in the future to show the way, not only from the library?
I think it will be convenient when all the icons are stored in a folder with the publication, not in the library.


Yes, I agree.

Re: Objects with Button images

PostPosted: Mon Dec 15, 2014 12:29 pm
by dec
Hello,

Maybe my npPush plugin can be interesting here.

This plugin put at your service the possibility to use advance buttons controls on your publications, who can be customized in several ways, using various gradients colors and styles, borders bevels, glyps images, wallpapers images and events.

Every button have default options and four states options: normal, hot, down and disabled states options. Like others NeoPlugins, you can use one or more Push objects (buttons) on your publications, customizing it separatelly, with shareable publication subroutines/events.


Like all my other plugins npPush support for embedded files, so you can use disk files or embedded files to establish individually images (BMP, JPG, GIF, TIFF and PNG are supported) up to four button states: normal, hot, down and disabled.

Re: Objects with Button images

PostPosted: Wed May 04, 2016 7:53 am
by NyperCro
Hi,

I tried that, but i can only change image for "up" status, i dont know how to do it for every state

Image
If you take a look at these img, you will see my problem, i need to create a script who will read specified line in config file (eg. GUI=2 or GUI=something or GUI=default) and change state for push button img "up-red","down-green" and "highlight-orange"

I tried to use Embedded pictures, but i get stuck only on "up" state
Can anyone give me an example script how to do it. I prefer to use Embedded pictures, so they cant be deleted by user.

I hope i explained my problem better than last time :)

Thank you

Re: Objects with Button images

PostPosted: Wed May 04, 2016 11:54 am
by Gaev
NyperCro:
If you take a look at these img, you will see my problem, i need to create a script who will read specified line in config file (eg. GUI=2 or GUI=something or GUI=default) and change state for push button img "up-red","down-green" and "highlight-orange"
With this option (for the PushButton object) you have to define the images at Design time ... they can not be changed at Run time.
I tried to use Embedded pictures, but i get stuck only on "up" state
Can anyone give me an example script how to do it. I prefer to use Embedded pictures, so they cant be deleted by user.
Note that the images you specify (at Design time) will be shown when the mouse pointer is ...

- outside the image rectangle (Up)
- howering over the image rectangle (Highlight)
- howering over the rectangle image with the left mouse button in the down/pressed position (Down)


For what you want to achieve, consider ...

a) using the Image object instead of the PushButton ... you can select an [Embedded] file to be shown in such an object

b) look at my previous post about how to change the image associated with such an object

c) you have to save current/changed selections in an external (text) file ... users must allow such files to be read/written on their respective folders ... if you don't want users to mess with the text files outside of your pub, then consider using a (password protected, encrypted) database file.

Re: Objects with Button images

PostPosted: Sat May 14, 2016 4:57 am
by fkapnist
I see what you mean....
I tried an Action such as
Code: Select all
FileCopy "C:\buttondown\NeoBookLogo2.jpg" "C:\buttondown\NeoBookLogo6.jpg"
It works in the design run-time but not the compiled exe....

I think a solution if, for example, you want three different images to display at Button Down, is to duplicate the button three times and place it on three different pages at exactly the same position. Each page will have a different image for Button Down but your set variable will decide which page's button to bring to front...


Or MUCH EASIER keep the button you have
but ignore the button down setting altogether (leave it blank) ... use the Left Click action to change the image (since it is also a button down action)... And use The Mouse Exit action (which is also a button up) to change back to the first image.

left click: SetObjectFileName "mybutton" "mypic2.jpg"
mouse exit: SetObjectFileName "mybutton" "mypic1.jpg"

Create a variable like [BtnDown] to determine which image displays with left click:

If "[BtnDown]" "=" "apple"
SetObjectFileName "mybutton" "applepic2.jpg"
EndIf

If "[BtnDown]" "=" "orange"
SetObjectFileName "mybutton" "orangepic2.jpg"
EndIf


:idea:

.