Jump to content
Sign in to follow this  

Fullscreen DesktopWidth / Height Control Placement

Recommended Posts

Imagine full screen gui, vertical list of labels and data controls.  Works great 1920, 1080 done.
Now the user replaces their video card from that old chip on the shelf.  Dusted it off, installed drivers, but it still doesn't support 1920, 1080.  I don't know how high it goes, I'm not the user.
So now data controls are drawn off the screen, and the button, well I'll fix the button once I figure out this part.
This is one of those problems I could solve with math.  My math skills are weak.
Is there an easy way to solve this issue?
Could you help me position and scale these gui controls to always be shown on @desktopwidth and @desktopheight?

func createfield($label_w= 250, $label_h= 50, $datawidth= 1050, $dataheight= 45)
    local $label_x= 50, $label_y= 0
    local $font_size= 20
;~  if @DesktopWidth< 1920 or @desktopheight< 1080 then
;~      $font_size= @desktopwidth/ 100
;~  endif
    guisetfont($font_size, 400, 0, "Arial");Choose a font for the gui
    for $i= 0 to $clientrecordmax-1; \/ ;Create the GUI fields
        $label_y= 50+ $i*50
        $controlfield[$i][0]= guictrlcreatelabel($field_info[$i][$fi_label], $label_x, $label_y, $label_w, $label_h)
        $datafieldpo_x= $label_x+$label_w
            case "input";create input
                $controlfield[$i][1]= guictrlcreateinput("", $datafieldpo_x, $label_y, $datawidth, $dataheight)
            case "combo";create combo
                $controlfield[$i][1]= guictrlcreatecombo("", $datafieldpo_x, $label_y, $datawidth, $dataheight, $CBS_DROPDOWNLIST)
            case "checkbox";create combo in checkbox case (yeah the combo haz 2 states)
                $controlfield[$i][1]= guictrlcreatecombo("", $datafieldpo_x, $label_y, $datawidth, $dataheight, $CBS_DROPDOWNLIST)
                guictrlsetdata($controlfield[$i][1], "No|Yes");
        endswitch;datatype - $field_info[$i][1]
    next;i in clientrecordmax-1

I considered Melba23's GUIFrame UDF (very nice btw), but I think the user wants all the controls visible at the same time.

Edit: I think I got it.  I'll calculate the largest label and data controls that will fit on the resolution.  Then use Melba23's StringSize UDF  to find the largest font size to fit the control.  I'll post when I work it out.

Edited by Xandy

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...