From 8b0a7da87b647c6e6c8476099cc7cbfa66443e9c Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sun, 5 May 2019 17:27:02 -0300 Subject: [PATCH] Autoname the new PictureBox control created after an image file is dropped. --- InForm/UiEditorPreview.bas | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/InForm/UiEditorPreview.bas b/InForm/UiEditorPreview.bas index 95dcb21..3b94afa 100644 --- a/InForm/UiEditorPreview.bas +++ b/InForm/UiEditorPreview.bas @@ -76,10 +76,14 @@ $IF WIN THEN FUNCTION CloseHandle& (BYVAL hObject AS LONG) FUNCTION GetExitCodeProcess& (BYVAL hProcess AS LONG, lpExitCode AS LONG) END DECLARE + + CONST PathSep$ = "\" $ELSE DECLARE LIBRARY FUNCTION PROCESS_CLOSED& ALIAS kill (BYVAL pid AS INTEGER, BYVAL signal AS INTEGER) END DECLARE + + CONST PathSep$ = "/" $END IF 'Load context menu icon image: @@ -351,6 +355,11 @@ SUB __UI_BeforeUpdateDisplay SelectNewControl TempValue PreviewLoadImage Control(TempValue), _DROPPEDFILE(i) + + b$ = MID$(_DROPPEDFILE(i), _INSTRREV(_DROPPEDFILE(i), PathSep$) + 1) + SWAP i, TempValue + GOSUB AutoName + SWAP i, TempValue END IF IF i = _TOTALDROPPEDFILES THEN _FINISHDROP NEXT