Objects with Button images

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Locked
NyperCro
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

Objects with Button images

Post 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
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Objects with Button images

Post 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]"
NyperCro
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

Re: Objects with Button images

Post by NyperCro »

Thank you, il will try it.
Is this possible for all 3 button images ? (Up, highlight, down) ?
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Objects with Button images

Post 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).
NeoSoft Support
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: Objects with Button images

Post 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**********************

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

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

**********************************************
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Objects with Button images

Post 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.
NeoSoft Support
User avatar
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Re: Objects with Button images

Post 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.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
NyperCro
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

Re: Objects with Button images

Post 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
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Objects with Button images

Post 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.
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: Objects with Button images

Post 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:

.
Locked