View previous topic :: View next topic |
Author |
Message |
lontongmalam Newbie cheater Reputation: 0
Joined: 13 Apr 2022 Posts: 17
|
Posted: Wed Feb 01, 2023 7:14 am Post subject: PopupMenu or OnRightClick |
|
|
Hello,
I made a calendar form for my trainer. I'm planning to set it as a popup for an image button.
How do I set a form (or a panel) as a popup menu for an object?
Or maybe we can implement a function for the right click too?
Thanks in advance!
Description: |
|
Filesize: |
7.88 KB |
Viewed: |
2482 Time(s) |
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Wed Feb 01, 2023 3:42 pm Post subject: |
|
|
It; Creates a panel right-click menu and menu items.
Code: | function popupblaclick1(sender)
showMessage('Menu 1 items 1 was clicked')
end
function bla2click1(sender)
showMessage('Menu 1 items 2 was clicked')
end
if f1 then f1.Destroy() f1=nil end
f1=createForm()
p1 = createPanel(f1)
p1.caption = "Right click me 1"
--popup menu
pmenu=createPopupMenu(p1)
pmenu_items=menu_getItems(pmenu)
--menu item 1
mi1=createMenuItem(pmenu)
menuItem_setCaption(mi1,'Panel Menu i1')
menuItem_onClick(mi1,popupblaclick1)
menuItem_add(pmenu_items, mi1)
--menu item 2
mi2=createMenuItem(pmenu)
menuItem_setCaption(mi2,'Panel Menu i2')
menuItem_onClick(mi2,bla2click1)
menuItem_add(pmenu_items, mi2)
control_setPopupMenu(p1, pmenu) |
In your case the multi-menu generator would be more useful, which would make the job a little shorter:
Code: | function popupblaclick1(sender)
showMessage('Menu 1 items 1 was clicked')
end
function bla2click1(sender)
showMessage('Menu 1 items 2 was clicked')
end
function popupblaclick2(sender)
showMessage('Menu 2 items 1 was clicked')
end
function bla2click2(sender)
showMessage('Menu 2 items 2 was clicked')
end
if f1 then f1.Destroy() f1=nil end
f1=createForm()
p1 = createPanel(f1)
p1.caption = "Right click me 1"
p2 = createPanel(f1)
p2.caption = "Right click me 2"
p2.Top = 60
--Multi menu func
function onMultiMenuItems(cnt,name,func,miname)
miname=createMenuItem(cnt)
menuItem_setCaption(miname,name)
menuItem_onClick(miname,func)
menuItem_add(cnt.items, miname)
return miname
end
pmenu1=createPopupMenu(p1)
pmenu_items=menu_getItems(pmenu1)
onMultiMenuItems(pmenu1,'Panel 1 Menu i1',popupblaclick1,"mi11")
onMultiMenuItems(pmenu1,'Panel 1 Menu i2',bla2click1,"mi12")
control_setPopupMenu(p1, pmenu1)
pmenu2=createPopupMenu(p2)
pmenu_items=menu_getItems(pmenu2)
onMultiMenuItems(pmenu2,'Panel 2 Menu i1',popupblaclick2,"mi21")
onMultiMenuItems(pmenu2,'Panel 2 Menu i2',bla2click2,"mi22")
control_setPopupMenu(p2, pmenu2)
|
Or different ideas may come depending on the way of use.
(There are crazy coders for this.
Just specify exactly what is required. )
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Wed Feb 01, 2023 10:38 pm Post subject: |
|
|
Here we go :
Code: | if f then f.destroy() end
f = createForm()
lbl = createLabel(f)
lbl.Left = 20
lbl.Top = 20
lbl.Font.Size = 14
lbl.Caption = "Current date : " ..os.date("%d-%m-%Y")
btn = createButton(f)
btn.Left = 20
btn.Top = 50
btn.Width = 120
btn.Caption = "Change Date"
cld = createCalendar(f)
cld.Left = btn.Left
cld.Top = btn.Top
cld.Visible = false
function getdate()
local vardate = cld.Date
vardate = vardate:gsub('(%d+)-(%d+)-(%d+)','%3/%2/%1')
lbl.Caption = "Current date : " ..vardate
cld.Visible = false
end
function chgDate()
showMessage("Select a date and double click on selected")
cld.Visible = true
end
f.Show()
cld.OnDblClick = getdate
btn.OnClick = chgDate |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
lontongmalam Newbie cheater Reputation: 0
Joined: 13 Apr 2022 Posts: 17
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Feb 02, 2023 6:22 am Post subject: |
|
|
here's an example of rightcliking the first scan button on CE's form (button needs to be enabled so open a process first)
Code: |
MainForm.btnNewScan.OnMouseDown=function(sender,button)
if button==mbRight then
local f=createForm(false)
f.borderStyle=bsNone
local cc=createComponentClass('TCalendar',f)
cc.parent=f
cc.OnDblClick=function()
print(cc.Date)
f.close()
end
f.autoSize=true
local x,y=getMousePos()
f.Top=y+1
f.Left=x+1
f.show()
f.setFocus()
f.OnDeactivate=function()
f.close()
end
end
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
Last edited by Dark Byte on Thu Feb 02, 2023 9:36 am; edited 1 time in total |
|
Back to top |
|
|
lontongmalam Newbie cheater Reputation: 0
Joined: 13 Apr 2022 Posts: 17
|
Posted: Thu Feb 02, 2023 6:48 am Post subject: |
|
|
Dark Byte wrote: | here's an example of rightcliking the first scan button on CE's form (button needs to be enabled so open a process first)
Code: |
MainForm.btnNewScan.OnMouseDown=function(sender,button)
if button==mbRight then
local f=createForm(false)
f.borderStyle=bsNone
local cc=createComponentClass('TCalendar',f)
cc.parent=f
cc.OnDblClick=function()
print(cc.Date)
f.close()
end
f.autoSize=true
local x,y=getMousePos()
f.Top=y+1
f.Left=x+1
f.show()
f.setFocus()
f.OnDeactivate=function()
f.close()
end
end
end
|
|
Yes! Finally. That's it! Thank you so much, Dark Byte; you're awesome!
Anyway, when is CE7.5 to be released?
I want to report a bug on custom types.
Like this, if I make a currency custom type on 4Bytes, let's say:
Code: | GBP£ == 1 (max. 2147483647)
JPY¥ == GBP£*158 (exchange rate) |
So if I put the maximum number for a signed integer, it should be:
Code: | JPY¥ = 339302416226 |
But, instead of showing the result, it will show a negative number, and CE still reads the integer maximum number as a display value, so I made an alternative using OnGetDisplayValue, with all of the exchange rates set to 1 in the custom type script and the real number for other functions, and it worked well for me.
I hope this issue will be fixed soon. Thank you.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Thu Feb 02, 2023 7:46 am Post subject: |
|
|
I made such an example because it looks like DB offered a solution.
Here is an alternative Popup trick that will rearrange the dates.
Code: | if f1 then f1.Destroy() f1=nil end
f1=createForm()
f1.height = 400
f1.Width = 400
f1.Popupmode=0;
f1.Position=poDesktopCenter
function loadUrl(link1)
local int=getInternet()
s=int.getURL(link1)
int.destroy()
return s
end
function crtPictures11(link2) --Internet
aLnk=loadUrl(link2)
local ss1=createStringStream(aLnk)
p1=createPicture()
p1.loadFromStream(ss1)
ss1.destroy()
return p1
end
edtPict=crtPictures11([[https://i.hizliresim.com/ac12b5i.png]])
logo1 = createImage(f1)
logo1.Height=30 logo1.Width=30 logo1.Left=250 logo1.Top=150
logo1.Stretch=true
logo1.Picture=edtPict
logo2 = createImage(f1)
logo2.Height=30 logo2.Width=30 logo2.Left=250 logo2.Top=190
logo2.Stretch=true
logo2.Picture=edtPict
logo3 = createImage(f1)
logo3.Height=30 logo3.Width=30 logo3.Left=250 logo3.Top=230
logo3.Stretch=true
logo3.Picture=edtPict
dtLbl1 = createLabel(f1)
dtLbl1.Left=290 dtLbl1.Top=155
dtLbl1.Font.Size=12 dtLbl1.caption=[[01/01/1900]]
dtLbl2 = createLabel(f1)
dtLbl2.Left=290 dtLbl2.Top=195
dtLbl2.Font.Size=12 dtLbl2.caption=[[01/01/1900]]
dtLbl3 = createLabel(f1)
dtLbl3.Left=290 dtLbl3.Top=235
dtLbl3.Font.Size=12 dtLbl3.caption=[[01/01/1900]]
dtPnl1 = createPanel(f1)
dtPnl1.Height=152 dtPnl1.Width=212
dtPnl1.Left=f1.Width - dtPnl1.Width - 10
dtPnl1.visible=false
cld = createCalendar(dtPnl1)
---------------------------------
local editLbl = ""
function getdate()
local vardate = cld.Date
vardate = vardate:gsub('(%d+)-(%d+)-(%d+)','%3/%2/%1')
editLbl.Caption = vardate
dtPnl1.Visible = false
end
onRightClick=function(cnt)
if pTimer then pTimer.Destroy() pTimer=nil end
pTimer=createTimer() pTimer.Interval=150
pTimer.Enabled=true
pTimer.OnTimer=function()
if isKeyPressed(VK_RBUTTON) then
sleep(200)
dtPnl1.Top = cnt.Top + cnt.Height
dtPnl1.Visible=true
end
end
cnt.OnMouseLeave=function()
if pTimer then pTimer.Destroy() pTimer=nil end
end
end
logo1.OnMouseMove=function()
editLbl=dtLbl1
onRightClick(logo1)
end
logo2.OnMouseMove=function()
editLbl=dtLbl2
onRightClick(logo2)
end
logo3.OnMouseMove=function()
editLbl=dtLbl3
onRightClick(logo3)
end
cld.OnDblClick = getdate |
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Feb 02, 2023 7:54 am Post subject: |
|
|
custom types are int size. So the max GBP value it can display would be 13591668
but ce 7.5 will also have support for string types so you can make it return any string as long as you like. (You just have to generate the string yourself)
it should come out very soon. Just testing a few last minute additions
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Feb 02, 2023 6:31 pm Post subject: |
|
|
DB, Also if possible, can we have a new function in CE Lua to create C/C++ structure, like lua alien did, on next CE 7.5 ?.
example :
Code: | LIBRARY_ITEM_DATA = alien.defstruct{
{ "hFile", "long" },
{ "BaseOfDll", "long" },
{ "hFileMapping", "long" },
{ "hFileMappingView", "long" },
{ "additionalFields", "char" }
}
LIBRARY_ITEM_DATA.size = LIBRARY_ITEM_DATA.size + 2*MAX_PATH - 1 |
Instead using memory stream and because the latest Lua alien works only for Lua 5.1 and 32 bit apps. Or is there any information for Lua alien binary file works with CE 7.4 64 bit?
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri Feb 03, 2023 1:47 am Post subject: |
|
|
There's no time to wtite a full parser for that, but you can of course write your own function wrapper that internally uses a memorystream.
(The Memorystream.size property can be modified directly as well)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Fri Feb 03, 2023 4:44 am Post subject: |
|
|
Ok. I will try it. DB, thanks for reply.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|