Jump to content

Random Resizing


Recommended Posts

Hi everyone

This is probably simple but its eluding me. Im creating programs mainly starting in koda. I run the program and on my computer it runs fine. when i try it on another on a laptop or pc with a very high resolution then some of the labels dont show completely or text doesnt fully show.

Does anyone know why?

Any help would be appreciated

thanks

jamie

Link to comment
Share on other sites

Maybe you are leaving the fonts at the default size, and the machines with higher resolutions have theme settings for large text?

If it's not that simple, post a short demo script of a GUI that shows your issue.

:x

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

This is the code

thanks

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\Phil pc project2\Files\Windows-Download.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt("GUICloseOnESC", 0)

Global $fDblClk = False
Global $aLV_Click_Info, $hTmp_Edit = 0
$dll = DllOpen("user32.dll")

Global $Database = "Database.ini", $read = IniReadSection($Database, "Info")

$GUI = GUICreate("Computer Store Database", 910, 570)

$NVT = _GUICtrlListView_Create($GUI, "", 5, 5, 900, 360); <<<<<<<<<<<<<<<<<<<<<<<<<<<
_GUICtrlListView_SetExtendedListViewStyle($NVT, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT)
_GUICtrlListView_InsertColumn($NVT, 0, "Name", 140, 2)
_GUICtrlListView_InsertColumn($NVT, 1, "Address", 140, 2)
_GUICtrlListView_InsertColumn($NVT, 2, "Telephone", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 3, "Date Brought in", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 4, "Due Date", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 5, "Employee", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 6, "Price", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 7, "Paid", 99, 2)
_GUICtrlListView_InsertColumn($NVT, 8, "Current Status", 1200, 0)


MsgBox(4096,"Info", "Dont forget to click save before you exit!!!")

GUICtrlCreateLabel("Address :", 5, 398, 45, 20)
GUICtrlCreateLabel("Name :", 5, 375, 45, 20)
GUICtrlCreateLabel("Telephone :", 5, 421, 58, 20) ;23
GUICtrlCreateLabel("Date in :", 5, 444, 50, 20)
GUICtrlCreateLabel("Due date :", 5, 467, 50, 20)
GUICtrlCreateLabel("Employee :", 5, 490, 50, 20)
GUICtrlCreateLabel("Current Status :", 5, 513, 100, 20)

GUICtrlCreateLabel("Price :", 210, 375, 45, 20)
GUICtrlCreateLabel("Paid :", 210, 398, 45, 20)


$address = GUICtrlCreateInput("", 80, 372, 120, 20)
$Name = GUICtrlCreateInput("", 80, 395, 120, 20)
$Telephone = GUICtrlCreateInput("", 80, 418, 120, 20) ;23
$DBI = GUICtrlCreateInput("", 80, 441, 120, 20)
$Ddate = GUICtrlCreateInput("", 80, 464, 120, 20)
$Employ = GUICtrlCreateInput("", 80, 487, 120, 20)
$Csitu = GUICtrlCreateInput("", 5, 533, 900, 20)

$Price = GUICtrlCreateInput("", 260, 372, 120, 20)
$Paid = GUICtrlCreateInput("N", 260, 395, 120, 20)


$Add = GUICtrlCreateButton("Add", 550, 365, 80, 25)
$Deletebutton = GUICtrlCreateButton("Delete", 550, 390, 80, 25)
$Erasebutton = GUICtrlCreateButton("Erase All", 550, 415, 80, 25);25
$savebutton = GUICtrlCreateButton("Save", 550, 440, 80, 25)
$exitbutton = GUICtrlCreateButton("Exit", 725, 390, 80, 25)

If $read <> 1 Then
    For $i = 1 To $read[0][0]
        $LisVille = $read[$i][0]
        $NameTele = StringSplit($read[$i][1], "|")
        $LisNom = $NameTele[1]
        $LisTelephone = $NameTele[2]
        $LisDBI = $NameTele[3]
        $LisDdate = $NameTele[4]
        $LisEmployee = $NameTele[5]
        $LisPrice = $NameTele[6]
        $LisPaid = $NameTele[7]
        $LisCsitu = $NameTele[8]
        _GUICtrlListView_AddItem($NVT, $LisVille,$i - 1); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisNom, 1); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisTelephone, 2); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisDBI, 3); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisDdate, 4); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisEmployee, 5); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisPrice, 6); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisPaid, 7); <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $i - 1, $LisCsitu, 8); <<<<<<<<<<<<<<<<<<<<<<<<<<<
    Next
EndIf
_GUICtrlListView_RegisterSortCallBack($NVT)
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1

    ; If a temporary edit exists
    If $hTmp_Edit <> 0 Then
    ; If ENTER pressed
    If _IsPressed("0D", $dll) Then
    ; Set label to edit content
    $sText = GUICtrlRead($hTmp_Edit)
    _GUICtrlListView_SetItemText($NVT, $aLV_Click_Info[0], $sText, $aLV_Click_Info[1])
    ; Delete temporary edit
    GUICtrlDelete($hTmp_Edit)
    $hTmp_Edit = 0
    EndIf
    ; If ESC pressed
    If _IsPressed("1B", $dll) Then
    ; Delete temporary edit
    GUICtrlDelete($hTmp_Edit)
    $hTmp_Edit = 0
    EndIf
    EndIf

    ; If an item was double clicked
    If $fDblClk Then
    $fDblClk = False
    ; Delete any existing temporary edits
    GUICtrlDelete($hTmp_Edit)
    ;$hTmp_Edit = 0
    ; Read current text of clicked label
    $sTmp_Text = _GUICtrlListView_GetItemText($NVT, $aLV_Click_Info[0], $aLV_Click_Info[1])
    ; Get label position
    Switch $aLV_Click_Info[1]
    Case 0 ; On Item
    $aLV_Rect_Info = _GUICtrlListView_GetItemRect($NVT, $aLV_Click_Info[0], 3)
    Case Else ; On SubItem
    $aLV_Rect_Info = _GUICtrlListView_GetSubItemRect($NVT, $aLV_Click_Info[0], $aLV_Click_Info[1])
    EndSwitch
    ; Create temporary edit
    $hTmp_Edit = GUICtrlCreateEdit($sTmp_Text, $aLV_Rect_Info[0] + 5, $aLV_Rect_Info[1] + 5, $aLV_Rect_Info[2] - $aLV_Rect_Info[0], $aLV_Rect_Info[3] - $aLV_Rect_Info[1], 0)
    GUICtrlSetState($hTmp_Edit, $GUI_FOCUS)
    EndIf




    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            DllClose($dll)
            ExitLoop
    Case $Add
    AddInfo()
    Case $Deletebutton
    _GUICtrlListView_DeleteItemsSelected($NVT)
    Case $Erasebutton
            _GUICtrlListView_DeleteAllItems($NVT)
    Case $savebutton
    Saveinfo()
    Case $exitbutton
    ExitLoop
        Case $NVT
            _GUICtrlListView_SortItems($NVT, GUICtrlGetState($NVT))
    EndSwitch

WEnd

_GUICtrlListView_UnRegisterSortCallBack($NVT)

Func AddInfo()
    $LisVille = GUICtrlRead($address)
    $LisNom = GUICtrlRead($Name)
    $LisTelephone = GUICtrlRead($Telephone)
    $LisDBI = GUICtrlRead($DBI)
    $LisDdate = GUICtrlRead($Ddate)
    $LisCsitu = GUICtrlRead($Csitu)
    $LisEmployee = GUICtrlRead($Employ)
    $LisPrice = GUICtrlRead($Price)
    $LisPaid = GUICtrlRead($Paid)

    $RegardeVille = _GUICtrlListView_FindText($NVT, $LisVille)
    $RegardeNom = _GUICtrlListView_FindInText($NVT, $LisNom)

    If $LisVille = "" Then
        MsgBox(64, "Error !", "You need an address")
    Else
        If $LisNom = "" Then
            MsgBox(48, "Errorr !", "You need a name !")
        Else
            If StringLen($LisTelephone) > 14 Then
                MsgBox(48, "Error !", "The telephone number is too long !")
            Else
                If StringLen($LisTelephone) < 5 Then
                    MsgBox(48, "Error !", "The telephone number is too short !")
                Else
    $iIndex = _GUICtrlListView_GetItemCount($NVT) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
    If $iIndex = -1 Then $iIndex = 0 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddItem($NVT, $LisVille, $iIndex) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisNom, 1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisTelephone, 2)
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisDBI, 3)      ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisDdate, 4)        ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisEmployee, 5)     ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisPrice, 6)        ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisPaid, 7)     ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        _GUICtrlListView_AddSubItem($NVT, $iIndex, $LisCsitu, 8)        ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
        GUICtrlSetData($address, "")
        GUICtrlSetData($Name, "")
        GUICtrlSetData($Telephone, "")
        GUICtrlSetData($DBI, "")
        GUICtrlSetData($Ddate, "")
        GUICtrlSetData($Employ, "")
        GUICtrlSetData($Price, "")
        GUICtrlSetData($Paid, "")
        GUICtrlSetData($Csitu, "")
    EndIf
EndIf

        EndIf
    EndIf
EndFunc   ;==>AjouterInfo


Func Saveinfo()
    If FileExists($Database) Then
    FileDelete($Database)
    EndIf
    For $i = 0 To _GUICtrlListView_GetItemCount($NVT) - 1
    $LisVille = _GUICtrlListView_GetItemText($NVT, $i, 0)
    $LisNom = _GUICtrlListView_GetItemText($NVT, $i, 1)
    $LisTelephone = _GUICtrlListView_GetItemText($NVT, $i, 2)
    $LisDBI = _GUICtrlListView_GetItemText($NVT, $i, 3)
    $LisDdate = _GUICtrlListView_GetItemText($NVT, $i, 4)
    $LisEmployee = _GUICtrlListView_GetItemText($NVT, $i, 5)
    $LisPrice = _GUICtrlListView_GetItemText($NVT, $i, 6)
    $LisPaid = _GUICtrlListView_GetItemText($NVT, $i, 7)
    $LisCsitu = _GUICtrlListView_GetItemText($NVT, $i, 8)
    IniWrite($Database, "Info", $LisVille, $LisNom & "|" & $LisTelephone & "|" & $LisDBI & "|" & $LisDdate & "|" & $LisEmployee & "|" & $LisPrice & "|" & $LisPaid & "|" & $LisCsitu)
    Next
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)

    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $NVT And DllStructGetData($tNMHDR, "Code") = $NM_DBLCLK Then
    $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($NVT)
    If $aLV_Click_Info[0] <> -1 Then $fDblClk = True
    EndIf
    Return $GUI_RUNDEFMSG

EndFunc

Drunken Frat-Boy Monkey Garbage

Link to comment
Share on other sites

Worked fine on all other normal and widescreen settings through 1280 X 1024. (Up until 150% dpi, but then many other windows look funny as well)

But on the low res:

You dont fit on an 800 X 600 (im guessing its the whole 900px width on your GUI action..)

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Hi guys

Ive just tried on another laptop at 1920 x 1080 and it seemed fine but both are widescreen. On a non widescreen does it make a huge difference such as compressing it a little? and if so how can i adjust it to stop happening?

thnaks

jamie

Drunken Frat-Boy Monkey Garbage

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...