Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Bitmap or Icon in Buttons

Bitmap or Icon in Buttons

Discuss topics that apply across the products, such as the PocketC language, or development in general

Postby stefan on Sat Oct 05, 2002 10:01 am

Hi, is anyone out there who can simply explain how to insert a bitmap or an icon into a button instead of text. Information I got from the web, the basic pocketc description and so on ist very irritating (sndmsg() necessary? what are the correct control styles for a simlpe pushbutton?)
Thanks in advance for a prompt answer!
Stefan
stefan
 
Posts: 3
Joined: Sat Oct 05, 2002 9:56 am
Location: Germany

Postby guy on Sun Oct 06, 2002 11:11 am

To put it simply, you cannot put an icon or a bitmap on a button using the basic PocketC library functions.

If you make direct calls to the Windows CE API functions you can put an image on a button, or any other control, but you won't be able to ensure that the image remains painted on the button unless you also use the Windows CE API event handling functions instead of the simplified PocketC standard library event functions.

If you want to only use the standard PocketC library functions then you can emulate buttons with images on them by drawing the buttons as images on the main window background and then responding to PM_BUTTONUP, PM_BUTTONDOWN and PM_MOUSEMOVE events to change the image and respond to clicks on the image (buttondown in screen area of button means change the image to the "down" version, buttonup anywhere after the button down means change back to original image and fake a click, you could use a move off the surface of the "button" as a cancel perhaps).

If you want to use the real Windows CE functions then you need the CE API library (below). You can then paint images on any control, not just the main window:

<pre id="code"><font face="courier" size="2" id="code">


#include "/pocketc/winuser.h"
#include "/pocketc/wingdi.h"


HDC hDeviceContext ; // Device context to draw on
HWND hWindowHandle ; // Window handle of button to draw on
HICON hIconHandle[5] ; // Icons from Pocket Word
HICON hResultHandle ; // Actual ICOn we want to put on the button


// Get the ICONs from Pocket Word


hResultHandle = ExtractIconEx("\\Windows\\pword.exe", 0,hIconHandle, 0, 1) ;


// Get the window handle of the button and get a device context for it


hWindowHandle = gethwnd(button_id) ; // Convert PocketC control ID to window handle
hDeviceContext = GetDC(hWindowHandle) ; // Get a context to paint onto


// Draw the icon onto the button


DrawIcon(hDeviceContext, 100,100, hResultHandle) ;


// Clean up


DestroyIcon(hResultHandle) ;
ReleaseDC(hWindowHandle, hDeviceContext) ;


</font id="code"></pre id="code">

If you want to ensure that the button remains painted then you'll need a Windows event loop that handles WM_PAINT messages. A PocketC event loop handling PM_PAINT won't work.



Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby stefan on Sun Oct 06, 2002 1:31 pm

Thanks a lot, I didn't expect the problem to be that complicated. By the way, I felt that it has to do with the ceapi library and installed the lib. But during start of some of the sample progs I got the message: this program requires pcktceapi.dll. please place this dll in the same directory. Since I had installed the package automatically from my desktop computer the dll was correctly placed in the windows directory. Do you have any idea what is the reason for that? My device is a Cassiopeia E10 running WinCE 2.11.
Thanks in advance,
Stefan
stefan
 
Posts: 3
Joined: Sat Oct 05, 2002 9:56 am
Location: Germany

Postby guy on Sun Oct 06, 2002 2:01 pm

It's possible that the library that it requires is not pcktceapi, but one of the libraries that pcktceapi uses. pcshell will report the error when it tries to load pcktceapi even if the actual library that it wants is different.

On a CE 2.11 machine you should have all of the standard libraries already installed.

I updated the installation because of a problem with the PocketPC2002, it's possible that I broke the other installations when I did this. You could try a direct installation onto your machine by downloading just the developer CAB file. The desktop installation is supposed to deduce the correct CAB file to install based on the device type, cpu and CE version of the device that's attached. You do this in the installation build by listing which devices each kit <b>won't</b> install on. If I missed some out then maybe the install copied the wrong CAB file to your device.

The missing DLL message normally only occurs on PocketPC machines when something uninstalls gx.dll (the game API). The only library that CEAPI uses on CE2.11 devices is the C runtime library.



Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby stefan on Sun Oct 06, 2002 3:20 pm

Thanks again for your prompt answer, but if I do so (downloading the appropriate cab file ppc201_mips.cab, since it is a CE 2.01 device) I get the answer, the cab file is not a correct WinCE install file. Is there a chance to obtain simply the pcktceapi.dll?
Thank you,
Stefan
stefan
 
Posts: 3
Joined: Sat Oct 05, 2002 9:56 am
Location: Germany

Postby guy on Mon Oct 07, 2002 8:11 am

If you have the correct CAB file, you should ignore the mesage that says it is incorrect. The incorrect test is the one against the cpu, version and platform. Obviously I've done something completely daft in the unsupported platforms list in the setup.

I'll go and change the setups and rebuild all of the cab files. I'll post back here once I've done it. This probably won't happen until tomorrow now I'm afraid. But do try just installing the CAB that you think it should be, and ignoring the complaint about the wrong platform.

The documentation that I have found on the Cassiopeia states that it is a CE 2.11 device, not a CE 2.01 device. You should go for the ppc211_mips.cab.



Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron