Many thanks indeed, Mark - just the ticket!
--
Oliver
_____
From: Mark Miesfeld [mailto:miesf...@gmail.com]
Sent: 07 December 2011 15:56
To: Open Object Rexx Users
Subject: Re: [Oorexx-users] Best way to show a certain kind of bitmap?
In case you don't notice, in the example I connected the double-click to the
static image, not the click event. So you have to double click on the icon
to see the switch.
--
Mark Miesfeld
On Wed, Dec 7, 2011 at 7:54 AM, Mark Miesfeld <miesf...@gmail.com> wrote:
Hi Oliver,
Here is a working example. It uses icons. A few changes and you could use
bitmaps.
Note in the example I load an icon: 'shaveIce.ico' To run the example you
need to supply your own icon file. The other icon, the question icon is
supplied by Windows.
To use bitmaps instead, you just need to change the style in
createStaticImage() to BITMAP instead of ICON and of course you need to load
bitmaps.
/* Simple Dialog to test static image controls */
.application~setDefaults("O", , .false)
.constDir[IDC_ICON_QUESTION] = 100
.constDir[IDC_ST_QUESTION] = 101
dlg = .SimpleDialog~new
dlg~execute("SHOWTOP")
return 0
::requires "ooDialog.cls"
::class 'SimpleDialog' public subclass UserDialog
::method init
forward class (super) continue
self~createCenter(186, 95, "Simple Question Dialog")
::method defineDialog
expose someIcon questionIcon isQuestion
self~createStaticImage(IDC_ICON_QUESTION, 14, 17, 20, 20, -
"NOTIFY ICON SIZEIMAGE")
self~createStaticText(IDC_ST_QUESTION, 59, 17, 122, 20)
self~createPushButton(IDOK, 126, 74, 50, 14, "DEFAULT", -
'Ok')
self~connectStaticEvent(IDC_ICON_QUESTION, "DBLCLK", -
onDoubleClick)
someIcon = .Image~getImage("shaveIce.ico", -
.Image~toID(IMAGE_ICON))
questionIcon = .Image~getImage(.Image~toID(IDI_QUESTION), -
.Image~toID(IMAGE_ICON))
isQuestion = .false
::method initDialog
expose iconImage iconText
iconImage = self~getStaticControl(IDC_ICON_QUESTION)
iconText = self~getStaticControl(IDC_ST_QUESTION)
self~swapIcons
::method onDoubleClick unguarded
expose iconImage questionIcon someIcon
self~swapIcons
::method swapIcons private unguarded
expose iconImage questionIcon someIcon isQuestion iconText
if isQuestion then do
iconImage~setImage(questionIcon)
iconText~setText("What is your question?")
isQuestion = .false
end
else do
iconImage~setImage(someIcon)
iconText~setText("This is where the question goes.")
isQuestion = .true
end
--
Mark Miesfeld
On Wed, Dec 7, 2011 at 6:04 AM, Oliver Sims
<oliver.s...@simsassociates.co.uk> wrote:
I want to display a small image on a dialog (a UserDialog).
When the user clicks this image, I want it to change to another image (a
"grayed-out" version of the first image).
This will be reset to the first image either programatically or when then
user clicks the grayed out image.
Each image is a separate bitmap file (but I could make it some other type
such as .ico).
My question is, what's the best (neatest) (least code) way to do this?
Many thanks for any thoughts,
Oliver
----------------------------------------------------------------------------
--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users