rübe 127 Posted February 1, 2011 So it turns out that the dialog from my latest mission doesn't work reliably across different systems. While everything seems fine here on my machine, the dialog doesn't seem to show up on other systems... and I have absolutely no clue why that is. First things first, here a demo of the dialog in question: http://non.sense.ch/shared/dialog.Takistan.pbo Dialog constants are defined in "dialogCore.hpp", basic control/gui class in "dialogCommon.hpp". The definition of the dialog itself is in "theDialogConf.hpp" and get's opened with "theDialogOpen.sqf". (automatically opened at the start of the mission. May be reopened with radio 0-0-1) And this is what it looks like here on my machine (and how it should look like): http://non.sense.ch/shared/dialog.screenshot.jpg The approach here is easy enough: take the whole screen (safeZone) and place various controls according to a relative grid. This is accomplished in "theDialogConf.hpp" at the top of the file: // the grid #define MCD_TEXTFIELD4_WIDTH safeZoneW * 0.07 #define MCD_TEXTFIELD2_WIDTH safeZoneW * 0.04 #define MCD_GRID_X1 (safeZoneW * 0.025) - DEFAULT_OFFSET_X #define MCD_GRID_X1S2 (safeZoneW * 0.105) - DEFAULT_OFFSET_X #define MCD_GRID_X1S3 (safeZoneW * 0.155) - DEFAULT_OFFSET_X #define MCD_GRID_X2 (safeZoneW * 0.220) - DEFAULT_OFFSET_X #define MCD_GRID_X3 (safeZoneW * 0.415) - DEFAULT_OFFSET_X #define MCD_GRID_X4 (safeZoneW * 0.610) - DEFAULT_OFFSET_X #define MCD_GRID_X5 (safeZoneW * 0.805) - DEFAULT_OFFSET_X #define MCD_GRID_Y1 safeZoneH * 0.78 #define MCD_GRID_Y2 safeZoneH * 0.82 #define MCD_GRID_Y2S2 safeZoneH * 0.87 #define MCD_GRID_Y3 safeZoneH * 0.90 #define MCD_GRID_Y4 safeZoneH * 0.94 while the basic controls or gui elements are defined with a relative width accordingly in "dialogCommon.hpp": #define DEFAULT_OFFSET_X safeZoneW * 0.15 #define DEFAULT_ELEMENT_WIDTH safeZoneW * 0.17 #define DEFAULT_ELEMENT_HEIGHT safeZoneH * 0.04 So this is a simple layout with five columns (and a small gap inbetween). The controls have the width of such a column (or a combined width for the deployment control-group). We get the clients "window" or max. available display-resolution with the safeZone commands, where safeZoneW is 100% of the width and safeZoneH is 100% of the height available. All straight forward, nothing too fancy, right? So what the heck goes wrong here? Where is my problem? Why does this dialog work as expected for me, while it doesn't even show up for others? That grid-approach is fine, isn't it? And if so, what else did I mess up? Anybody? Please? :o Share this post Link to post Share on other sites
Clayman 20 Posted February 1, 2011 Well I'm not sure if this might help, as I totally suck when it comes to maths, so I can't really say where exactly the problem is. But I noticed you are not using the SafeZoneX and SafeZoneY commands anywhere in your code. This is what I use for my dialogs and as far as I can tell, it works for any menu size and screen resolution. x = (0.606 * SafeZoneW + SafeZoneX); y = (0.8 * SafeZoneH + SafeZoneY); w = (0.085 * SafeZoneW); h = (0.025 * SafeZoneH); I can't say where you have to change your code, as -like I said- I'm not good at math. But maybe it will get you started. Share this post Link to post Share on other sites
rübe 127 Posted February 1, 2011 Ahhh I think I've figured it out now! The grid-positions or "anchor points" need to be "calibrated" with safeZoneX and safeZoneY to start with... which I didn't do in the first place... DOH! :o So the gird definition should look like this: // the grid #define MCD_TEXTFIELD4_WIDTH safeZoneW * 0.07 #define MCD_TEXTFIELD2_WIDTH safeZoneW * 0.04 #define MCD_GRID_X1 safeZoneX + (safeZoneW * 0.025) #define MCD_GRID_X1S2 safeZoneX + (safeZoneW * 0.105) #define MCD_GRID_X1S3 safeZoneX + (safeZoneW * 0.155) #define MCD_GRID_X2 safeZoneX + (safeZoneW * 0.220) #define MCD_GRID_X3 safeZoneX + (safeZoneW * 0.415) #define MCD_GRID_X4 safeZoneX + (safeZoneW * 0.610) #define MCD_GRID_X5 safeZoneX + (safeZoneW * 0.805) #define MCD_GRID_Y1 safeZoneY + (safeZoneH * 0.78) #define MCD_GRID_Y2 safeZoneY + (safeZoneH * 0.82) #define MCD_GRID_Y2S2 safeZoneY + (safeZoneH * 0.87) #define MCD_GRID_Y3 safeZoneY + (safeZoneH * 0.90) #define MCD_GRID_Y4 safeZoneY + (safeZoneH * 0.94) I'm pretty sure that's it, though I have to wait for some feedback first. Oh and Clayman: Shouldn't this: x = (0.606 * SafeZoneW + SafeZoneX); y = (0.8 * SafeZoneH + SafeZoneY); be: x = (0.606 * SafeZoneW) + SafeZoneX; y = (0.8 * SafeZoneH) + SafeZoneY; instead? (I'm pretty sure now, hehe) Share this post Link to post Share on other sites
Clayman 20 Posted February 1, 2011 Yes, that looks much better. Should work now. Oh and Clayman:... What I do remember from school is "Punktrechnung vor Strichrechnung", so actually the brackets aren't needed at all. ;) Share this post Link to post Share on other sites
[frl]myke 14 Posted February 1, 2011 What I do remember from school is "Punktrechnung vor Strichrechnung", so actually the brackets aren't needed at all. ;) But with brackets it is easier to track for those which don't remember this rule. ;) But you're right, mathematically it doesn't matter. Share this post Link to post Share on other sites
rübe 127 Posted February 1, 2011 I don't care if multiplication is more potent than addition ("Punkt vor Strich"). It just hurts my eyes (and brains!!! argh) without proper brackets. hehe Oh and I'm glad to inform you that this dialog now indeed works. Like in everywhere. :D ^^ As usual I had some thick slices of cucumber on my eyes (and my brains!!! oO). :o Share this post Link to post Share on other sites