CJPushButton Image

This forum is for support of XCodeJock
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: CJPushButton Image

#11 Post by rdonnay »

Sorry, I didn't get to it. I'll try today.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: CJPushButton Image

#12 Post by skiman »

Hi Roger,

Did you find time to check this?

If you don't have the time, I can use the current possibilities. I want to incoporate these buttons in my application. I just don't want to add them and to see a that it can be done with one command-line a week later.

If it is not planned in the first weeks, I won't wait, otherwise I wait for a modification on xcodejock.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: CJPushButton Image

#13 Post by rdonnay »

Chris -

I looked into this and thought that it may be more of a problem than it is worth but now I realize I may have been on the wrong track.

The Pushbutton control requires using the GlobalSettings object to load the bitmaps or icons if you want to use images in markup.

Now after looking at the specs again, I think I can do what you want but you cannot use images in markup text.

I'll work on it again today.

Roger
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: CJPushButton Image

#14 Post by rdonnay »

Ok, I finally figured out a seamless way to handle this problem.

The attached file contains a new sample pushbutton program and updated XCodeJock source.

Copy XCJCLASS.PRG and XCODEJOCK.PRG to \exp19\source\xcodejock.
Copy XCODEJOCK.CH to \exp19\include
Copy PUSHBUTTON.PRG to \exp19\XCodeJock\Samples\SuiteControls\Pushbutton

Rebuild XCodeJock.Dll by running \exp19\source\xcodejock\build19_sl1.bat.

You will still need to create a SuiteControlGlobalSettings object if you intend to use images in markup text, so you will see this in the sample program, but you will not need it to attach regular icons or bitmaps.
Attachments
pushbutton.zip
(32.83 KiB) Downloaded 1041 times
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: CJPushButton Image

#15 Post by skiman »

Hi Roger,

The sample is working with a bitmap file. I would like to use it with a bitmap from resources.

I modified the following in xjclass.prg

Code: Select all

IF !Empty(aOptions[24])
	if valtype(aOptions[24]) == "C"
		CJLoadBitmap aOptions[24] ID 1 STATE xtpImageNormal PARENT ::globalSettings:icons
		oIcon := ::globalSettings:icons:getImage(1,32)
		::picture := CJ_Picture(oIcon,xtpImageNormal)
	endif
	if valtype(aOptions[24]) == "N"
		aResFile := DC_BitmapResourceFile()
		FOR i := 1 TO Len(aResFile)
			nHandle := aResFile[i]
			CJLoadBitmapFromResource aOptions[24] HANDLE nHandle ID 1 STATE xtpImageNormal PARENT ::globalSettings:icons
			oIcon := ::globalSettings:icons:getImage(1,32)
			::picture := CJ_Picture(oIcon,xtpImageNormal)
		next
	endif
ENDIF
This way it is working with a bitmap from resources. I suppose the same has to be done when using icons.
Best regards,

Chris.
www.aboservice.be

Post Reply