More Gadget Attributes

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

More Gadget Attributes

Post by darklordz »

More Gadget Attributes,
for example, Imagegadget has no Tooltip or Actions, this is a problem for me because it the only way to mimic a gui in PB if it had advanced events.

Image
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: More Gadget Attributes

Post by tinman »

darklordz wrote:More Gadget Attributes,
for example, Imagegadget has no Tooltip or Actions, this is a problem for me because it the only way to mimic a gui in PB if it had advanced events.
ImageGadgets are just a way of displaying images in your GUI without you having to worry about refreshing them.

It might be easier to have a "no border" flag for ButtonImageGadget, as it already has the other stuff you mention.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

Even if there was a no border flag for the image button witch isn't possible because the button gadget is created trough windows api. There would still be an issue of the UP/Down/Over States. On a Button it's simple, BevelUp,BevelDown. But thats not what i need. I need the image gadget like in VB. Sad but true...
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Imagegadget-events are fine.
For the first time try this
snippet

which uses WindowMouseX.....
SPAMINATOR NR.1
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

@ the moment i am using windowmousex() n same for y, do define regeons but it's sutch an elaborate method....
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Use a CallBack
Check for the WM_LBUTTONDOWN and WM_LBUTTONUP messages
and use ChildWindowFromPoint_() to get the imagegadget handle where the mouse is.
WM_MOUSEMOVE can be used to make flat style buttons
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

can't find it but someone in the past has poseted this code to understand events from imagegadgets :wink:

Code: Select all

;GADGET IDs
#Image0=0
;WINDOW ID
#Window1=0
#SS_NOTIFY=256 
;WINDOW
OpenWindow(#Window1,150,70,550,350,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_TitleBar,"Window1")
CreateGadgetList(WindowID(#Window1))
;LoadImage(0,"C:\yourimage.bmp")
CreateImage(0,60,60)

hwimage=ImageGadget(#Image0,10,16,300,232,UseImage(0))
os=getwindowlong_(hwimage,#GWL_STYLE)
setwindowlong_(hwimage,#GWL_STYLE,os|#SS_NOTIFY)
;EVENT LOOP
Repeat
  EventID=WaitWindowEvent()
    Select EventID
      Case #PB_EventGadget
        Select EventGadgetID()
          Case #Image0
            beep_(1000,100)
        EndSelect
    EndSelect
Until EventID=#PB_EventCloseWindow
Christos
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

@Berikco, tried callback, didnt work, can you gomme an example....

@plouf, Looks Great I thank you....
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

I fixed the callback. It Works Perfectly now....for those that want the code.....Lemme know...
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

if you have a nice example, why not post it in tricks and tips
Post Reply