From: Daan L. <daa...@xs...> - 2003-09-04 07:49:29
|
Thanks for you sample Luc! I'll add it to the CVS tree and it will ship in version 0.2. Still, one glitch is the popupmenu that I was expecting near the button, not top left. Also, I did not use a Use a "wxBitmapButton" as u mentions, I did not found it, neither what it should provides.. hm ? Well, a wxWindows type "wxBitmapButton" is translated as "bitmapButtonCreate" in "WxcClasses". When I create abstractions in the "WX" library, I remove the "Create" bit, and call it "bitmapButton". The abstractions take for example a list of attributes as arguments etc. -- Daan. {-| Author : Luc Taesch 2003 Maintainer : da...@cs... Stability : provisional Portability : portable ? (tested on XP) Illustrate more controls from wxHaskell, Hacked from Controls.hs ( Daan Leijen 2003) namely bitmapButtons, righ click menus, vertical labels on notebooks, usage of tooltips -} module Main where import Graphics.UI.WX import Graphics.UI.WXH main :: IO () main = start gui gui :: IO () gui = do -- main gui elements: frame, panel, text control, and the notebook f <- frame [text := "Controls" ] p <- panel f [] nb <- notebook2 p [] textlog <- textCtrl p WrapLine [enable := False] file <- menuList "&File" [] aRightClick <- menuItem file "Say Something\tCtrl+Q" "An interesting Message" [] -- use text control as logger textCtrlMakeLogActiveTarget textlog logMessage "logging enabled" -- button page p1 <- panel nb [text := "buttons"] bm <- bitmapCreateFromFile ".\\haskell_icon.gif" ok <- bitmapButton p1 0 bm [text := "Ok", on command := logMessage "bitmap button pressed", tooltip := "tooltip", on clickRight := (\pt -> menuPopup file pt p)] -- specify layout set f [layout := container p $ column 0 [ tabs nb [container p1 $ margin 10 $ floatCentre $ row 5 $ [widget ok] ] , hfill $ widget textlog ] , on (menu aRightClick) := infoDialog f "Say.." "Something" , clientSize := sz 400 300 ] return () where logSelect labels w = do i <- get w selection s <- get w (item i) logMessage ("selected index: " ++ show i ++ ": " ++ s) -- like notebook, with labels created on the side ( rather than on top): wxNB_RIGHT notebook2 parent props = do nb <- notebookCreate parent idAny rectNull ( wxCLIP_CHILDREN + wxNB_RIGHT) set nb props return nb -- like buttonEx, with a bitmap instead of the label bitmapButton parent flags bm props = do --bm <- bitmapCreateFromFile ".\\haskell_icon.gif" b <- bitmapButtonCreate parent idAny bm rectNull flags set b props return b ----- Original Message ----- From: Daan <mailto:daa...@xs...> Leijen To: 'Luc Taesch' <mailto:li...@ta...> ; wxh...@li... Sent: Monday, September 01, 2003 11:36 AM Subject: [wxhaskell-users] drag and drop, notebook, bitmapbuttons, rightclick Hi Luc, I will just answer all your questions in one go :-) does wxhaskell support drag and drop ? No, not yet. It needs some more C wrapper support. However, it is easy to add and it will be there in version 0.3 or something. (I plan to release 0.2 in a few weeks). (unless you add it for me and send me the patches... see wxDropTarget and friends). > Is there any (layout ?) possibilities to have the notebook "buttons" on the (right side) rather than on the top ? Yes. You have to create the notebook with the "wxNB_RIGHT" flag. Look at the source code in "WX.Controls" to see how to create a notebook control. (it seems from the docs though that "wxNB_RIGHT" is not supported yet by wxWindows under windowsXP). > doew wxhaskell support bitmapbuttons ? Yes. Use a "wxBitmapButton". with "bitmapButtonCreate". > does wxHaskell support rightclick menu, an dideally specific to an area , say on a button ? Yes. Use "on clickRight" together with "menuPopup". I hope this helps, All the best. Daan. ps. I think you could have answered the last three questions yourself by studying the documentation and samples. Don't worry though :-), I am very happy that you use my stuff and I have no problem answering any questions at all -- however, any time I spend on email can't be spend on advancing wxHaskell. Therefore, try to experiment and study the docs a little bit before asking questions. |