1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

Allow form icons without 32bit images.

User will be warned that the indicated file may be corrupted.
This commit is contained in:
Fellippe Heitor 2016-12-10 21:22:29 -02:00
parent 514cfbd91d
commit 32eec34699
2 changed files with 18 additions and 2 deletions

View file

@ -661,7 +661,7 @@ END SUB
SUB __UI_BeforeUpdateDisplay
DIM b$, PreviewChanged AS _BYTE, SelectedProperty AS INTEGER, UiEditorFile AS INTEGER
DIM PreviewHasMenuActive AS INTEGER, i AS LONG
DIM PreviewHasMenuActive AS INTEGER, i AS LONG, Answer AS _BYTE
STATIC MidRead AS _BYTE, PrevFirstSelected AS LONG
IF NOT MidRead THEN
@ -702,6 +702,10 @@ SUB __UI_BeforeUpdateDisplay
__UI_ActivateMenu Control(__UI_GetID("AlignMenu")), False
__UI_ForceRedraw = True
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
ELSEIF CVI(b$) = -4 THEN
'User attempted to load an icon file that couldn't be previewed
Answer = MessageBox("Icon couldn't be previewed. Make sure it's a valid icon file.", "", MsgBox_OkOnly + MsgBox_Exclamation)
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
END IF
b$ = SPACE$(4): GET #UiEditorFile, OffsetTotalControlsSelected, b$

View file

@ -323,7 +323,10 @@ SUB __UI_BeforeUpdateDisplay
Text(__UI_FormID) = b$
ELSE
_ICON
Text(__UI_FormID) = ""
IF _FILEEXISTS(b$) THEN
SendSignal -4
Text(__UI_FormID) = b$
END IF
END IF
END IF
CASE 4 'Top
@ -1111,6 +1114,15 @@ SUB SendData (b$, Offset AS LONG)
CLOSE #FileNum
END SUB
SUB SendSignal (Value AS INTEGER)
DIM FileNum AS INTEGER, b$
FileNum = FREEFILE
OPEN "UiEditor.dat" FOR BINARY AS #FileNum
b$ = MKI$(Value): PUT #FileNum, OffsetNewDataFromPreview, b$
CLOSE #FileNum
END SUB
FUNCTION IconPreview& (IconFile$)
DIM IconFileNum AS INTEGER
DIM Preferred AS INTEGER, Largest AS INTEGER