Hard coding picture on a button
Moderator: Rathinagiri
Hard coding picture on a button
Hi
Is there a way to hard code a picture on a button in the code.
For eg if in a button control we include PICTURE "HP_PRINT" we will get PRINTER icon on the button, without icon actually being in the folder
similarly if in a button control we include PICTURE "HP_CLOSE" we will get EXIT icon on the button, without icon actually being in the folder
Is it possible to do this for any icon which is used as a picture in button control ?
Is there a way to hard code a picture on a button in the code.
For eg if in a button control we include PICTURE "HP_PRINT" we will get PRINTER icon on the button, without icon actually being in the folder
similarly if in a button control we include PICTURE "HP_CLOSE" we will get EXIT icon on the button, without icon actually being in the folder
Is it possible to do this for any icon which is used as a picture in button control ?
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Hard coding picture on a button
RPC wrote: ↑Thu Dec 07, 2017 7:12 pm Hi
Is there a way to hard code a picture on a button in the code.
For eg if in a button control we include PICTURE "HP_PRINT" we will get PRINTER icon on the button, without icon actually being in the folder
similarly if in a button control we include PICTURE "HP_CLOSE" we will get EXIT icon on the button, without icon actually being in the folder
Is it possible to do this for any icon which is used as a picture in button control ?
Code: Select all
IF I understand right:
Did you tried hard code path include the icon ?
fe
PICTURE "C:\IMAGES\ICONS\ExitIcon.ico"
ELSE
Would you supply a SSW ( Short, Simple and Working) example
ENDIF
Viva INTERNATIONAL HMG
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Hard coding picture on a button
I think you are talking about embedding the icon and other application pictures inside EXE files. You have to just add to resource file. You can find many samples in the samples folder.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Hard coding picture on a button
Hi Esgici
The solution you provided will work well if the exe is run on a particular computer from any folder or sub-folder.
I think it will not work, ie icons will not be ported along with exe file, if exe is run on a different computer.
What I want is the icon/image should get embedded in the exe file so icons/images are not required to sent along with exe file.
The solution you provided will work well if the exe is run on a particular computer from any folder or sub-folder.
I think it will not work, ie icons will not be ported along with exe file, if exe is run on a different computer.
What I want is the icon/image should get embedded in the exe file so icons/images are not required to sent along with exe file.
Re: Hard coding picture on a button
Yes Rathinagiri I talking about embedding the icon/image.Rathinagiri wrote: ↑Fri Dec 08, 2017 4:15 am I think you are talking about embedding the icon and other application pictures inside EXE files. You have to just add to resource file. You can find many samples in the samples folder.
I tried looking in samples folder but could not find any example. I tried entering the details of icon in *.rc file but icons didn't get embedded.
For eg I entered following line in *.rc file
open BITMAP open.bmp
the open icon did not get embedded in resultant exe file.
Thanks
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Hard coding picture on a button
Can you give a sample project?
The files shall have .ico file for Icons.
The files shall have .ico file for Icons.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Hard coding picture on a button
It seems to me that the icon files (ico) included in resources are not supported by the PICTURE property for the BUTTON control.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Hard coding picture on a button
Yes. For picture property I think we need bitmap?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Hard coding picture on a button
Works fine with bitmap, png, gif, jpg, tif
Re: Hard coding picture on a button
Hi Edward,
Your sample works fine in MiniGUi Extended (with a minor modification).
The updated source is below
Code: Select all
#include "hmg.ch"
Function Main()
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 430 ;
HEIGHT 270 ;
ICON "B3" ;
MAIN ;
TITLE 'Button Test'
@ 50,20 BUTTONEX B_1 CAPTION "B1" PICTURE "B1" WIDTH 110 HEIGHT 100 VERTICAL ACTION Nil
@ 50,155 BUTTONEX B_2 CAPTION "B2" PICTURE "B2" WIDTH 110 HEIGHT 100 VERTICAL ACTION Nil
@ 50,290 BUTTONEX B_3 CAPTION "B3" ICON "B3" WIDTH 110 HEIGHT 100 VERTICAL ACTION Nil
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
- Attachments
-
- Scrrensot of a sample
- screen.png (12.71 KiB) Viewed 4645 times
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein