Jump to content
HurleyShanabarger

Recommendation / Modern GUIs

Recommended Posts

Posted (edited)

Hello,

in the last 15 year there was not one programming tasks that I could not get done with AutoIt. Research within this forum always helped me to get a good solution for the actual tasks.

I have a new project upcoming and it will be heavily GUI related - and I think will need to implement a modern DataGridView  and this is missing in AutoIt. I think DataGridView is an element from C# and I am wondering what would be the best approach - is Visual Studio a good way to create a program that is using a DataGridView or is there an easier way for someone that is just used to AutoIt?

Thanks for any suggestions :)

Edited by HurleyShanabarger

Share this post


Link to post
Share on other sites

is there a reason you can't use ListView?  I know there are some udf's I've used in the past that allow inline edits of a listview item.


hmm... I guess I have to have a signature...

Share this post


Link to post
Share on other sites

HurleyShanabarger,

Take a look at my GUIListViewEx UDF (the link is in my sig) which allows you to have ListViews with editable cells (plain text, combos, date controls), drag'n'drop, colours and much more. It might allow you to stay with AutoIt for your upcoming project.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Well, currently the data is handled within and excel document and there is a lot of logic put into the macro behind.

So basically the DataGridView would represent the contents of the sheet and the GUI around it would be for handling data import/export/verification.

One of the main features would be to show/hide columns, but the one feature that I have to seen with a ListView is to freeze a column. 

Share this post


Link to post
Share on other sites

HurleyShanabarger,

What exactly do you mean by "freezing" a column? Making it uneditable? Making it a fixed width?

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Posted (edited)

HurleyShanabarger,

You can always use 2 synchronized ListViews like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <GuiScrollBars.au3>

Global Const $iMax = 40

Global $iPos_1 = 0, $iPos_2 = 0

$hGUI = GUICreate("Synchro Pair", 255, 240, -1, -1)
$cLV_2 = GUICtrlCreateListView("Col 1|Col 2|Col 3|Col 4", 60, 5, 185, 220)
$hLV_2 = GUICtrlGetHandle($cLV_2)
GUISetState(@SW_SHOW)

$hGUI_Child = GUICreate("", 50, 220, 10, 5, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
$cLV_1 = GUICtrlCreateListView("Frozen", 0, 0, 85, 220)
$hLV_1 = GUICtrlGetHandle($cLV_1)
GUISetState()

For $i = 1 To $iMax
    GUICtrlCreateListViewItem("Item " & $i, $cLV_1)
    GUICtrlCreateListViewItem("Item " & $i, $cLV_2)
Next

Global $aRect = _GUICtrlListView_GetItemRect($hLV_2, 0)
Global Const $iDeltaY = $aRect[3] - $aRect[1]
GUIRegisterMsg($WM_NOTIFY, "_WM_Notify")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_Notify($hWnd, $Msg, $wParam, $lParam)
    Local $iLines_1 = _SendMessage($hLV_1, $LVM_GETTOPINDEX)
    Local $iLines_2 = _SendMessage($hLV_2, $LVM_GETTOPINDEX)
    If $iLines_1 <> $iLines_2 Then
        _SendMessage($hLV_1, $LVM_SCROLL, 0, ($iLines_2 - $iLines_1) * $iDeltaY)
    EndIf
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>_WM_Notify

That seems to give you the same sort of effect. Worth pursuing?

M23

Edited by Melba23
Better example script

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

In general this might work; but it might be a pain in the a** to keep the data in both synchronized.

Also I don't thing that end-user will like the flickering while scrolling.

Share this post


Link to post
Share on other sites

HurleyShanabarger,

I cannot see why keeping the data synchronised in the pair would be any more difficult than keeping a single ListView up to date - but only you know exactly what is required. And I see no flickering when the pair are scrolled.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Posted (edited)

@HurleyShanabarger, that video is of a web thing. If you give me the html, I'll give it a try at having it as a "control" in AutoIt via embedded IE.
Just have all the web interaction via AJAX, where you have the event you'd handle in au3 and i'll pass it back as JSON for the JS to handle.
Is not impossible, just somewhat cumbersome.

27662575_GIF6-25-20207-27-04PM.thumb.gif.472c93fa3e88816568392ccc0bf952d3.gif

or try 

 

Edited by argumentum

Share this post


Link to post
Share on other sites
Posted (edited)

regarding the synchronized ListViews example by @Melba23 above: there is a bug when you scroll all the way down - then the last rows do not remain paired. this is because the frozen listview allows for one extra scroll, because the data area height is greater, because the dynamic listview has an horizontal scrollbar.

a crude solution would be to set the height of the frozen listview minus the height of the horizontal scrollbar, which is roughly 18px, so instead of 220 it should be 202.

EDIT: or perhaps there is a way to calculate the height of the horizontal scrollbar at run-time? i did not find such method, but i guess there must be...

Edited by orbs

Share this post


Link to post
Share on other sites
On 6/23/2020 at 4:37 PM, Melba23 said:

HurleyShanabarger,

I cannot see why keeping the data synchronised in the pair would be any more difficult than keeping a single ListView up to date - but only you know exactly what is required. And I see no flickering when the pair are scrolled.

M23

If you scroll in the first Listview you will have this flickering:

Flicker.gif.c10c6cfd990522759c24c97accc5194e.gif

 

Thanks for the other ideas, I will look into it.

Share this post


Link to post
Share on other sites

orbs,

Quote

perhaps there is a way to calculate the height of the horizontal scrollbar at run-time? 

Indeed there is:

_WinAPI_GetSystemMetrics(2) ; Width of VScrollbar:  SM_CXVSCROLL
_WinAPI_GetSystemMetrics(3) ; Height of HScrollbar: SM_CYHSCROLL

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Posted (edited)

@HurleyShanabarger

Did you try to set the extended style $LVS_EX_DOUBLEBUFFER to the ListViews?

It should reduce the flickering during scroll, as it is stated in the Help file about ListView control :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...