Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #1090
| From | "Willie Moore" <williem@wmconsulting.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Highlighting Buttons on tab page freezes program |
| Date | 2011-05-10 11:57 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <iqbqoo$dld$1@speranza.aioe.org> (permalink) |
| References | <4dc85f07$0$47019$c30e37c6@pit-reader.telstra.net> <iqa97b$1eh$1@speranza.aioe.org> <4dc8ba70$0$47013$c30e37c6@pit-reader.telstra.net> <iqb5ch$dn0$1@speranza.aioe.org> <4dc95f7f$0$47016$c30e37c6@pit-reader.telstra.net> |
Craig,
Here is a subclass. It isnt exact but it works and uses the image in the 2.8
pushbutton class instead of using an ownerdrawn.
Regards,
Willie
CLASS _ButtonImageList INHERIT ImageList
HIDDEN _oImage AS VObject
METHOD INIT(oImage) CLASS _ButtonImageList
//PP-030915
_oImage := oImage
//Ueberbacher 101209: use Add() to add an icon or AddMask() to add a
bitmap
SUPER:INIT(1, oImage:Size, , _OR(ILC_COLOR32, ILC_MASK))
RETURN SELF
ACCESS Image CLASS _ButtonImageList
RETURN _oImage
METHOD __SetImage(oNewImage) CLASS _PushButton
LOCAL oImageList AS _ButtonImageList
IF IsThemeEnabled()
IF IsInstanceOfUsual(oNewImage, #ICON) .OR.
IsInstanceOfUsual(oNewImage, #Bitmap)
oImageList := _ButtonImageList{oNewImage}
IF IsInstanceOfUsual(oNewImage, #ICON)
oImageList:Add(oNewImage)
ELSE
// Ueberbacher-101209: this is the only way to show a bitmap
transparently on a Button WITH XP-Style
oImageList:AddMask(oNewImage, oMaskColor)
ENDIF
SELF:ImageList := oImageList
RETURN TRUE
ENDIF
ENDIF
RETURN FALSE
ASSIGN Image(oNewImage) CLASS _PushButton
LOCAL dwType AS DWORD
LOCAL lStyle AS LONG
LOCAL lSetStyle AS LONG
LOCAL hImage AS PTR
LOCAL oIcon AS Icon
LOCAL oBitMap AS bitmap
lStyle := GetWindowLong(SELF:Handle(), GWL_STYLE)
lStyle := _AND(lStyle, _NOT(_OR(BS_ICON,BS_BITMAP)))
// Ueberbacher-101209: set the Button style (BS_ICON or BS_BITMAP) only
IF there IS no caption.
// This is the right way (MSDN) to show text and image on a Button.
IF Empty(cCaption)
lStyle := _OR(lStyle, lSetStyle)
ENDIF
SetWindowLong(SELF:Handle(), GWL_STYLE, lStyle)
IF !SELF:__SetImage(oNewImage)
IF IsInstanceOfUsual(oNewImage, #ICON) .OR.
IsInstanceOfUsual(oNewImage, #Bitmap)
oImage := oNewImage
IF IsInstanceOf(oImage, #ICON)
dwType := IMAGE_ICON
lSetStyle := BS_ICON
oIcon := oNewImage
hImage := oIcon:Handle()
ELSE
dwType := IMAGE_BITMAP
lSetStyle := BS_BITMAP
oBitMap := oNewImage
hImage := oBitMap:Handle()
ENDIF
SendMessage(SELF:Handle(), BM_SETIMAGE, dwType, LONG(_CAST,
hImage))
ENDIF
ENDIF
RETURN oImage
CLASS _PushButton INHERIT PushButton
PROTECT oMaskColor AS Color
ASSIGN ImageList(oImageList) CLASS _PushButton
LOCAL sBImageList IS _winButton_ImageList
LOCAL oImgList AS ImageList
IF IsInstanceOfUsual(oImageList, #ImageList)
oImgList := oImageList
IF IsThemeEnabled()
sBImageList.himl := oImgList:Handle()
// Ueberbacher-101209: if there is a caption, align the Button
on the left
IF Empty(cCaption)
sBImageList.uAlign := Button_IMAGELIST_ALIGN_CENTER
ELSE
sBImageList.uAlign := BUTTON_IMAGELIST_ALIGN_LEFT
ENDIF
SendMessage(hWnd, BCM_SETIMAGELIST, 0, LONG(_CAST,@sBImageList))
ENDIF
ENDIF
RETURN (oImage := oImgList)
ASSIGN MaskColor(oColor) CLASS _PushButton
oMaskColor := oColor
RETURN NIL
METHOD INIT( oOwner, xID, oPoint, oDimension, cText, kStyle, lDataAware)
CLASS _PushButton
IF IsInstanceOfUsual(xID,#ResourceID)
SUPER:INIT(oOwner, xID, oPoint, oDimension, , kStyle,lDataAware)
ELSE
SUPER:INIT(oOwner, xID, oPoint, oDimension, "Button",
kStyle,lDataAware)
IF !IsNil(cText)
SELF:caption := cText
ENDIF
ENDIF
// Ueberbacher-101209: a mask color is needed to draw bitmaps
transparently on a button WITH xp-style
oMaskColor := Color{192, 192, 192}
RETURN SELF
"Craig Dawson" wrote in message
news:4dc95f7f$0$47016$c30e37c6@pit-reader.telstra.net...
Willie,
Yes you were right, thanks for the tip - the GDI objects go through the roof
and finally the app fails.
The buttons are actually inherited from the IconPushButton class originally
from Harald Kogler and modified by Paul DB on 31st October 2005. Whilst I
don't have any icons on them, I do have text and they are coloured.
Perhaps someone has a newer version of the IconPushButton class? I searched
but could not find anything. There were a lot of people who also implemented
it in their code (according to Google) around the same time I did in
November of 2005 and perhaps have already discovered and/or solved the
problem.
Clutching at straws I guess as many have moved on from VO, but you never
know :) Does anyone have a newer version?
Regards, Craig.
"Willie Moore" <williem@wmconsulting.com> wrote in message
news:iqb5ch$dn0$1@speranza.aioe.org...
> Craig,
>
> How about the buttons, are they standard buttons or are the a subclassed
> button? I have seen button subclasses over the years that used images
> incorrectly. They would leak resources. Here is a trick that you may or
> may not know. Open up taskmanager on the machine you are testing. Go to
> the processes view and click on view and the columns. With GDI objects up,
> you can run your program and see what happens when you wave the mouse
> around. The other place to look for problems would be if you are doing
> things with gradients on the datawindows. You have to make sure that those
> objects are being cleared properly. It is a nasty think to hunt because it
> can come from many places. Are you using windows themes in your program
> ( rounded buttons, etc)? If so, make a backup of and then delete the
> manafest file. If the problem goes away then you would be closer to
> figuring out where the issue is. Lastly, don't make too many changes in a
> row before you retest. If you do you wont really know which one fixed the
> issue. It takes longer to test this way but gives better results in the
> end.
>
> Regards,
> Willie
>
> "Craig Dawson" wrote in message
> news:4dc8ba70$0$47013$c30e37c6@pit-reader.telstra.net...
>
> Thanks Willie but no mousemove or mousedrag code whatsoever.
> No errors in any logs are created either.
> Strange that I have not yet been able to recreate it in XP - just Vista &
> Win7 (all are up to date with service packs).
> -----
> Regards, Craig.
>
> "Willie Moore" <williem@wmconsulting.com> wrote in message
> news:iqa97b$1eh$1@speranza.aioe.org...
>> Craig,
>>
>> That is pretty strange. I would look at your mouse code. Are you doing
>> any handlers to track the mouse position? If you are using mousemove or
>> mousedrag you can eat up memory if you are not careful. Is their any
>> error message in any log? It will be a hard one to debug but the best way
>> would be with debout32() and pass debug strings so you can see what the
>> program is doing without being intrusive with the debugger. While you do
>> that you can also monitor your GDI objects. See if they are rising.
>>
>> Regards,
>> Willie
>>
>> "Craig Dawson" wrote in message
>> news:4dc85f07$0$47019$c30e37c6@pit-reader.telstra.net...
>>
>> Hi all, I have a strange problem.
>>
>> I have a POS system that has a window with tabs on them. On those tabs
>> are a
>> number of buttons that fill the entire tab page.
>> It was designed for touch screens and day-in, day-out, it works quite
>> well -
>> however for those customers that do not have one and only use a mouse to
>> click the buttons, they are reporting a problem.
>>
>> If they only use the mouse, after around 40-50 transactions, the system
>> locks up and freezes (note that touch screens are no problem).
>> At first, I could not reproduce it, however if I got the mouse pointer
>> and
>> moved it rapidly around in circles over the buttons (they would highlight
>> /
>> dehighlight / highlight again atc), after about 30-35 seconds or so
>> bingo!
>> It froze and the screen went all spastic with buttons disappearing and
>> then
>> reappearing in different positions, etc.
>>
>> Anyone had this happen to them or have any clues as to what would be
>> causing
>> this strange behaviour?
>>
>> Thanks in advance, Craig.
>>
>
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-10 07:39 +1000
Re: Highlighting Buttons on tab page freezes program "Willie Moore" <williem@wmconsulting.com> - 2011-05-09 21:51 -0500
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-10 14:09 +1000
Re: Highlighting Buttons on tab page freezes program "Willie Moore" <williem@wmconsulting.com> - 2011-05-10 05:52 -0500
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-11 01:53 +1000
Re: Highlighting Buttons on tab page freezes program "Willie Moore" <williem@wmconsulting.com> - 2011-05-10 11:57 -0500
Re: Highlighting Buttons on tab page freezes program "Willie Moore" <williem@wmconsulting.com> - 2011-05-10 11:57 -0500
Re: Highlighting Buttons on tab page freezes program "Bernhard Mayer" <Idonotexisthere@nowhere.com> - 2011-05-11 07:35 +0200
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-13 06:59 +1000
Re: Highlighting Buttons on tab page freezes program "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-05-13 08:57 +1000
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-14 08:47 +1000
Re: Highlighting Buttons on tab page freezes program "Bernhard Mayer" <Idonotexisthere@nowhere.com> - 2011-05-13 07:55 +0200
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-14 08:52 +1000
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-14 17:16 +1000
Re: Highlighting Buttons on tab page freezes program - Solved! "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-15 02:30 +1000
Re: Highlighting Buttons on tab page freezes program - Solved! "Gerhard Bunzel" <g.bunzel@domonet.de> - 2011-05-16 00:08 +0200
Re: Highlighting Buttons on tab page freezes program - Solved! "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-17 21:55 +1000
Re: Highlighting Buttons on tab page freezes program - Solved! "Willie Moore" <williem@wmconsulting.com> - 2011-05-17 07:19 -0500
Re: Highlighting Buttons on tab page freezes program - Solved! "Paul D B" <polleke@NOMORESPAMhnt.be> - 2011-05-18 17:00 +0200
Re: Highlighting Buttons on tab page freezes program Sherlock <sherlock@sherlock.com.au> - 2011-05-10 05:01 -0700
Re: Highlighting Buttons on tab page freezes program "Craig Dawson" <craig@control.nospam.net.au> - 2011-05-11 01:58 +1000
Re: Highlighting Buttons on tab page freezes program "Paul D B" <polleke@NOMORESPAMhnt.be> - 2011-05-18 16:39 +0200
Re: Highlighting Buttons on tab page freezes program "Paul D B" <polleke@NOMORESPAMhnt.be> - 2011-05-18 16:42 +0200
csiph-web