Page 2 of 2

Re: CJPushButton Image

Posted: Tue Jun 15, 2010 8:25 am
by rdonnay
Sorry, I didn't get to it. I'll try today.

Re: CJPushButton Image

Posted: Wed Jun 23, 2010 12:31 am
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.

Re: CJPushButton Image

Posted: Wed Jun 23, 2010 7:14 am
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

Re: CJPushButton Image

Posted: Thu Jun 24, 2010 4:19 pm
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.

Re: CJPushButton Image

Posted: Wed Jun 30, 2010 10:08 pm
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.