HDPI - DragItem Picture

This is the first app where I’ve really had to use HDPI alot, and somethings don’t seem to work as expected :frowning:
I’ve created ImageSets with proper @1x and @2x versions of all the icons and graphics
For Toolbars these work properly
For Listbox CellBackgroundPaint event, these work using g.DrawPicture icon,x,y where icon refers to the appropriate imageset

However when I create a DragItem (using the same imagesets as for Listbox) it always uses the @1x image
The only real difference is I need to shrink the image, but it doesn’t change if I leave it as-is

		p=New picture(w,h)
		p.Graphics.foreColor=&cff0000
		p.Graphics.FillRect 0,0,w,h
		p.Graphics.DrawPicture xxx48,0,0,h,h ,0,0,xxx48.Width,xxx48.height
		x=x-(w/2)
		y=y-(h/2)
		d=New DragItem(Me,x,y,p.Width,p.Height,p)
		d.Text=Trim(ConvertEncoding(s,Encodings.UTF8))
		d.drag

W,H are width and height of the desired drag image… and will be different based on the listbox cell selected
the rectangle may be wider than it is high, but the icon will always be square (ultimately centered horizontally)
the XXX48 imageset contains a 48x48 and 96x96 image (this image works in Toolbar/Listbox CellBackgroundPaint)
but in the above code always returns the 48x48

Dave if you have an imageset called

image_48

  • 48x48 @ 72 dpi
  • 96x96 @ 72 dpi
  • 144x144 @ 72 dpi

in code you just request image_48 xojo will assign the right one (@x1, @x2 or @x3) for the build apps.
That’s probably why you can’t get the xxxx96 or xxxx48.Image96

You have to think of the 3 given images (@x1, @x2 or @x3) being 1. You can only use the set as an image or multiple different sets as multiple different images.

Your best off making another image_96 set containing the bigger (@x2 or 96x96) image. And use that as the dragitem.

[quote=360288:@Derk Jochems]Dave if you have an imageset called

image_48

  • 48x48 @ 72 dpi
  • 96x96 @ 72 dpi
  • 144x144 @ 72 dpi

in code you just request image_48 xojo will assign the right one (@x1, @x2 or @x3) for the build apps.
That’s probably why you can’t get the xxxx96 or xxxx48.Image96

You have to think of the 3 given images (@x1, @x2 or @x3) being 1. You can only use the set as an image or multiple different sets as multiple different images.[/quote]
Please note that IS EXACTLY WHAT I AM DOING

xxx48 has just what you described (without the @3x as that is for iOS apps only)

as I said it works for Toolbar and Listbox CellbackgroundPaint, but NOT for DragItem

[quote=360289:@Dave S]Please note that IS EXACTLY WHAT I AM DOING

xxx48 has just what you described (without the @3x as that is for iOS apps only)

as I said it works for Toolbar and Listbox CellbackgroundPaint, but NOT for DragItem[/quote]

I see. But how would xojo know what icon to use for the purpose, as you might drag it anywhere? You might be able to select the right image from the resources by file? The convert it into a picture. It’s more work but i guess you might want to create a FB case.

Guess that is kind of the basis of my question then isn’t it?
for this situation the icon never leaves the screen… .but as you pointed out… Xojo won’t know that.

If I have to “live” with it dragging the @1x that really won’t be a HUGE issue, as they are small icons, the clarity isn’t important for the few seconds they will be visible

It would be nice to have

  • image_48.Size1 As Picture
  • image_48.Size2 As Picture
  • image_48.Size3 As Picture
    Would be Read-Only Picture

If the imageset had such properties, you as developer have more control. Did you make an FB case for it?

having size1, size2, size3 is limiting as any, or every, time apple ms etc add a size we need to add an accessor
instead there is already
http://documentation.xojo.com/index.php/Picture.ImageCount
http://documentation.xojo.com/index.php/Picture.IndexedImage

nope… I gave up on trying to make FB work years ago

p=New picture(w,h) p.Graphics.foreColor=&cff0000 p.Graphics.FillRect 0,0,w,h // Place here the code to detech the screen depth and // assign the correct Picture(i) to Picture_Depth [a Picture Dimed ro get the correct Depth image) // then p.Graphics.DrawPicture Picture_Depth,0,0,h,h ,0,0,Picture_Depth.Width,Picture_Depth.Height
'p.Graphics.DrawPicture xxx48,0,0,h,h ,0,0,xxx48.Width,xxx48.height[/code]

Just a guess: not tested code.