Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Restricted Width for PopupControl Images
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Restricted Width for PopupControl Images

 Post Reply Post Reply
Author
Message
meaningoflights View Drop Down
Groupie
Groupie


Joined: 27 October 2007
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote meaningoflights Quote  Post ReplyReply Direct Link To This Post Topic: Restricted Width for PopupControl Images
    Posted: 25 July 2008 at 6:44am
Hi,

I am using a PopupControl with a 111x101 jpg image in it.

1. How do I set the PopupItems width so all of the image is shown? I cant work out what is preventing it, as per the screenshot:










2. There's another problem noted in the code comments of this repro A RollOver effect appears when set differing values for "Left" and "Right" arguments in the Popup.AddItem method, see pic below, the Right argument takes priority over the Left argument when the mouse is rolled over the 111x101 area:



Please help, here is the repro, all you have to do is put a command button and Popupcontrol on a form, make 111x101 image and run this code:



Option Explicit

Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst _
    As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 _
    As Long, ByVal un2 As Long) As Long
Private Const IMAGE_BITMAP = &O0
Private Const LR_LOADFROMFILE = 16
Private Const LR_CREATEDIBSECTION = 8192



Private Sub Command_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call SetPopupTheme(PopupControl)
Call PopupControl.Show

End Sub

Sub SetPopupTheme(ByVal Popup As XtremeSuiteControls.PopupControl)
   
    Dim item As PopupControlItem

    Popup.RemoveAllItems
    Popup.Icons.RemoveAll
   
    On Error Resume Next

    'The image doesn't move on mouse over
    'Set item = Popup.AddItem(12, 12, 12, 12, "")
   
   ' The image moves on mouse over! and the picture is still half its width
    Set item = Popup.AddItem(12, 12, 123, 113, "")
   
    item.TextAlignment = DT_SINGLELINE
   
    item.SetIcons LoadBitmap("Blob.jpg"), 0, xtpPopupItemIconNormal Or xtpPopupItemIconSelected Or xtpPopupItemIconPressed


  
    Popup.VisualTheme = xtpPopupThemeOffice2007
    Popup.SetSize 270, 122
   
    Popup.Animation = 1
    Popup.AnimateDelay = 256
    Popup.ShowDelay = 2000
    Popup.Transparency = 200
    Popup.AllowMove = True

End Sub




Function LoadBitmap(Path As String) As Long
    LoadBitmap = LoadImage(App.hInstance, App.Path + "\" + Path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
End Function





Thanks in advance for trying to reproduce and solve this half image issue
Jeremy Thompson (MCSD)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2008 at 2:57am
Hi,
 
item.SetIcons waits that bitmap will have 3 states - normal, hot, presesed.
 
just use
Popup.Icons.LoadBitmap instead.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
meaningoflights View Drop Down
Groupie
Groupie


Joined: 27 October 2007
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote meaningoflights Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2008 at 10:27pm
Great, that pointed me in the right direction and using the sample PopupControlLayer, I found what I was missing:


Popup.Icons.LoadBitmap App.path & "\Blob.jpg", 100, xtpImageNormal
item.IconIndex = 100


Instead of :

item.SetIcons LoadBitmap("Blob.jpg"), 0, xtpPopupItemIconNormal Or xtpPopupItemIconSelected Or xtpPopupItemIconPressed





More info:

I've found the order you add items does make a difference.

When I loaded a icon, then text then bitmap I saw a weird effect... It was really hard to select icon buttons as the hover area was a quarter of the icons size. Loading Bitmaps, then Icons then text seems to be the best order.
Jeremy Thompson (MCSD)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.