Jump to content
Sign in to follow this  
luis713

controls in some resolution

Recommended Posts

luis713

Hi, I'm working on a project but I noticed an error on my script, I'll copy the code here when I get home, the main issue is appearance, I wrote the code in my personal computer but I will share it, my screen resolution is 1024x768, but when I tested the script on a computer with a different resolution the text of some controls were not showed correctly.

another issue is an image, the same problem, on some resolutions doesn't show full, is there a function to avoid these problems?

I created the controls considering screen resolution, so I thought there shouldn't be problem, all my controls were created like this

guictrlcreatelabel("example", @desktopwidth * 0.05, @desktopheight * 0.1, @desktopwidth * 0.05, @desktopheight * 0.025)

I thought it could be because of the font size

Share this post


Link to post
Share on other sites
jdelaney

You should probably only use the desktop to determine your window size, and then make the control sizes relative to the window.  otherwise, provide a script that replicates your issue.

 

Another suggestion is to maintain minimums.   example for input, don't make it smaller than a height of 15

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
luis713
50 minutes ago, jdelaney said:

You should probably only use the desktop to determine your window size, and then make the control sizes relative to the window.  otherwise, provide a script that replicates your issue.

 

Another suggestion is to maintain minimums.   example for input, don't make it smaller than a height of 15

jdelaney, could you give me an example? because I was trying to make them relative to desktop resolution

Edited by luis713

Share this post


Link to post
Share on other sites
jdelaney

I always make my gui apps like this...then you just add to the array, and it generates the new gui, dynamically:

 

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$iControlHeight = 15
$iButtonHeight = 20
$iControlBuffer = 3
$iLabelWidth = 120
$iInputWidth = 175

$hWin = GUICreate("My App",$iInputWidth+$iLabelWidth+$iControlBuffer*3,0)

Enum $iControl_1D_Something, $iControl_1D_AnotherThing, $iControl_1D_More, $iControl_1D_MoreStill, $iControl_1D_UBound
Enum $iControl_2D_LabelID, $iControl_2D_InputID, $iControl_2D_LabelText, $iControl_2D_UBound

Local $aControls[$iControl_1D_UBound][$iControl_2D_UBound]

$aControls[$iControl_1D_Something][$iControl_2D_LabelText] = "TextAB"
$aControls[$iControl_1D_AnotherThing][$iControl_2D_LabelText] = "TextCD"
$aControls[$iControl_1D_More][$iControl_2D_LabelText] = "Text12"
$aControls[$iControl_1D_MoreStill][$iControl_2D_LabelText] = "Text"

$iControlLine = $iControlBuffer
For $i = 0 To UBound($aControls)-1
    $aControls[$i][$iControl_2D_LabelID] = GUICtrlCreateLabel($aControls[$i][$iControl_2D_LabelText],$iControlBuffer,$iControlLine,$iLabelWidth,$iControlHeight)
    GUICtrlSetResizing(-1,$GUI_DOCKALL)
    $aControls[$i][$iControl_2D_LabelID] = GUICtrlCreateInput("",$iControlBuffer*2+$iLabelWidth,$iControlLine,$iInputWidth,$iControlHeight)
    GUICtrlSetResizing(-1,$GUI_DOCKALL)
    $iControlLine+=$iControlHeight+$iControlBuffer
Next

; Add in other controls after the array:
$hButton = GUICtrlCreateButton("Do something",$iControlBuffer*2+$iLabelWidth,$iControlLine,$iInputWidth,$iButtonHeight)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$iControlLine+=$iButtonHeight+$iControlBuffer

$aPos = WinGetPos($hWin)
$iStartHeight = $aPos[3]
WinMove($hWin,"",$aPos[0],$aPos[1],$aPos[2],$iStartHeight+$iControlLine)

GUISetState(@SW_SHOW, $hWin)
MsgBox(1,1,1)

 

Manipulate the first 5 variables to change the look of the app.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×