03-21-2025, 09:26 PM
That's the stuff I've already been doing for the buttons, outlines, etc., but now I'm trying to figure a way to just copy screen 0 stuff to hardware.
I noticed this does not seem likely as from my edit in the above post...
If I did convert this routine to graphics I might find myself involved with further work to redo the menu highlighting with mouse and keys, too.
So if there isn't a way to copyimage a Screen 0 image to hardware and putimage it back, it leaves three choices. 1) never let a popup move and make sure it never overlaps a hardware image. 2) Convert the popup to a graphics routine and copy/put it as a hardware image, or 3, scrap using screen 0 completely.
Pete
I noticed this does not seem likely as from my edit in the above post...
Quote: What I'm hung up on is _newimge(w, h, 32) allows z = _copyimage(t, 33) but the screen 0 form of _newimage(w, h, 0) won't allow z = _copyimage(t, 33)So while making a block is actually easier in graphics with line and BF, converting this is a lot more involved...
Also z& = _copyimage(0) only allows for Screen z& but I can't get it working with _putimage.
Code: (Select All)
Sub MyInput_PopUp (mki As inputvars, menu$(), hl, popit, lb, mb, rb, my, mx, mw, drag, b$)
Static initiate, nomi, oldmy, cp1, cp2, cp3, cp4, cp5
Static atmp As String
Static menu_restrict()
Static MenuHL, MenuT, MenuR, MenuB, MenuL, myalt, mxalt
y = CsrLin: x = Pos(0)
restore_color1 = _DefaultColor: restore_color2 = _BackgroundColor
mki.CurShow = 0: Locate , , mki.CurShow ' Hide cursor
If initiate = 0 Then
initiate = 1
cp1 = 0 ' Available menu item.
cp2 = 5 ' Popup background. (Same as mki.skin_bkg)
cp3 = 7 ' Unavailable menu item.
cp4 = 7 ' Shadow.
cp5 = 8 ' Characters under shadow.
Restore PopupMenuData
PopupMenuData: ' eof must be lowercase.
Data Cut.........Ctrl+X,Copy........Ctrl+C,Paste.......Ctrl+V,Clear..........Del,Select All..Ctrl+A
Data Close..........Esc,eof
nomi = 0
Do
Read tmp$
If tmp$ = "eof" Then Exit Do
nomi = nomi + 1
ReDim _Preserve menu$(nomi)
menu$(nomi) = tmp$
Loop
End If
Do
mxalt = 0
If b$ = Chr$(0) + "H" Or mw = -1 Then
If (MenuHL - MenuT + 1) \ 2 > 1 Then
myalt = MenuHL - 2: mxalt = -1
End If
ElseIf b$ = Chr$(0) + "P" Or mw = 1 Then
If MenuHL = 0 Then
myalt = MenuT + 1: mxalt = -1
Else
If (MenuHL - MenuT + 1) \ 2 < nomi Then
myalt = MenuHL + 2: mxalt = -1
End If
End If
ElseIf b$ = Chr$(13) Or mb = 2 Then
If menu_restrict((MenuHL - MenuT + 1) \ 2) = 0 Then
mki.mvar = (MenuHL - MenuT + 1) \ 2
popit = 0
Exit Do
End If
End If
Select Case mki.mvar
Case -1 ' Hover.
If mxalt = 0 Then myalt = my: mxalt = mx
i = myalt > MenuT And myalt < MenuB And mxalt > MenuL And mxalt < MenuR
If i Or mxalt = -1 Then
i = (myalt - MenuT) \ 2 <> (myalt - MenuT) / 2 And myalt <> oldmy
If i Or mxalt = -1 Then ' Works for odd or even number top margins.
If MenuHL Then ' Remove highlighting from previous hover.
atmp = Space$(mki.mwidth - 2)
Mid$(atmp, 2, Len(menu$((MenuHL - MenuT + 1) \ 2))) = menu$((MenuHL - MenuT + 1) \ 2)
Locate MenuHL, MenuL + 2 - 1
If menu_restrict((MenuHL - MenuT + 1) \ 2) Then Color cp3, cp2 Else Color cp1, cp2
Print atmp
End If
atmp = Space$(mki.mwidth - 2)
Mid$(atmp, 2, Len(menu$((myalt - MenuT + 1) \ 2))) = menu$((myalt - MenuT + 1) \ 2)
Locate myalt, MenuL + 2 - 1
If menu_restrict((myalt - MenuT + 1) \ 2) Then Color cp2, cp3 Else Color cp2, cp1
Print atmp;
Color cp1, cp2
MenuHL = myalt
oldmy = my
End If
If lb = 2 Then
If menu_restrict((myalt - MenuT + 1) \ 2) = 0 Then
mki.mvar = (myalt - MenuT + 1) \ 2
popit = 0
Exit Do
End If
End If
Else
' Toggle close popup menu.
If lb = 1 Or rb = 1 Then
If myalt >= _ScreenY And my <= _ScreenY + 24 And mx >= _ScreenX + 36 And mx <= _ScreenX + 48 Then
popit = 0
mki.mvar = 0: Exit Do
Else
If myalt >= _ScreenY And my <= _ScreenY + _FontHeight * (_Height + 1) And mx >= _ScreenX And mx <= _ScreenX + _FontWidth * _Width Then
Else ' Outside of app win.
popit = 0
mki.mvar = 0: Exit Do
End If
End If
End If
End If
If Len(b$) Then
Select Case b$
Case Chr$(0) + "S", Chr$(22), Chr$(24), Chr$(1), Chr$(3): Exit Do
Case Chr$(27): b$ = "": mki.mvar = 0: popit = 0: Exit Do ' Simply close popup.
End Select
End If
Case Else ' Open the menu.
menu_variety = 1
h = 5 ' Variable to determine margin spaces from the right of menu.
If nomi > _Height - 2 Or Len(menu$(1)) > _Width - 4 Then nomi = 0: initiate = 0: Exit Sub ' Not enough room to open popup.
ReDim menu_restrict(nomi) ' Restrictions.
If text$(mki.fld) = "" Then
For i = 1 To nomi - 2: menu_restrict(i) = 1: Next
Else
If hl = 0 Then
For i = 1 To 4: menu_restrict(i) = 1: Next
End If
End If
If Len(_Clipboard$) Then menu_restrict(3) = 0 Else menu_restrict(3) = 1 ' End Restrictions.
For i = 1 To nomi
j = Len(menu$(i))
If j > k Then k = j
Next
mki.mwidth = k + h
mki.mheight = nomi * 2 + 1 ' Add one for the separate border element.
Select Case menu_variety
Case 0 ' Fixed menu to left.
MenuT = 3: MenuL = 1: MenuR = MenuL + mki.mwidth: MenuB = MenuT + mki.mheight
Case 1 ' Movable menu.
While _MouseInput: Wend
MenuT = _MouseY + 1 ' One below input line.
MenuL = _MouseX
If MenuT + mki.mheight >= _Height Then MenuT = _Height - mki.mheight - 1 ' -1 for shadow.
If MenuL + mki.mwidth >= _Width Then MenuL = _Width - mki.mwidth - 1 ' -1 for shadow.
MenuR = MenuL + mki.mwidth: MenuB = MenuT + mki.mheight
End Select
mki.mvar = -1 ' Identifies the menu is open.
PCopy 0, 1
Color cp1, cp2
Locate MenuT, MenuL
Print Chr$(218) + String$(mki.mwidth - 2, 196) + Chr$(191)
For i = 1 To mki.mheight - 2
Color cp1, cp2: Locate , MenuL
Print Chr$(179); Space$(mki.mwidth - 2) + Chr$(179);
Color cp2, cp4: Print Chr$(Screen(CsrLin, Pos(0))) + Chr$(Screen(CsrLin, Pos(0) + 1)): Color cp5, cp2
Next
Color cp1, cp2: Locate , MenuL
Print Chr$(192) + String$(mki.mwidth - 2, 196) + Chr$(217);
Color cp2, cp4: Print Chr$(Screen(CsrLin, Pos(0))) + Chr$(Screen(CsrLin, Pos(0) + 1))
Locate , MenuL + 2
For i = 1 To mki.mwidth
Print Chr$(Screen(CsrLin, Pos(0)));
Next
Locate MenuT + 2, MenuL + 2
For i = 0 To nomi - 1
Locate MenuT + 1 + i * 2, MenuL + 2
If menu_restrict(i + 1) Then Color cp3, cp2 Else Color cp1, cp2
Print menu$(i + 1)
Color cp1, cp2
Locate , MenuL
If i + 1 < nomi Then Print "Ã" + String$(mki.mwidth - 2, Chr$(196)) + "´";
Next
End Select
Exit Do
Loop
If popit = 0 Then PCopy 1, 0: MenuHL = 0
Color restore_color1, restore_color2
Locate y, x
_KeyClear
Select Case mki.mvar
Case 1: b$ = Chr$(24) ' Cut
Case 2: b$ = Chr$(3) ' Copy
Case 3: b$ = Chr$(22) ' Paste
Case 4: b$ = Chr$(0) + "S" ' Delete
Case 5: b$ = Chr$(1) ' Select All
Case 6 ' Do nothing. (Close Menu).
End Select
If mki.mvar > 0 Then mki.mvar = 0
End Sub
If I did convert this routine to graphics I might find myself involved with further work to redo the menu highlighting with mouse and keys, too.
So if there isn't a way to copyimage a Screen 0 image to hardware and putimage it back, it leaves three choices. 1) never let a popup move and make sure it never overlaps a hardware image. 2) Convert the popup to a graphics routine and copy/put it as a hardware image, or 3, scrap using screen 0 completely.
Pete