Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Form Flashing On Lose Focus

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
lontongmalam
Newbie cheater
Reputation: 0

Joined: 13 Apr 2022
Posts: 17

PostPosted: Tue Sep 26, 2023 4:13 pm    Post subject: Form Flashing On Lose Focus Reply with quote

How do I make a custom form that flashes when I switch my focus to another form?

I'm sorry, but I'm not sure what it's called. Here's an example:

Assume I generate a form called frmAAA using an auto-assemble script. This form includes an edit box and other components required by the script to continue the operation.

I want frmAAA to flash whenever the user clicks on another form to keep the user's attention on it until the user complete filling out the required data or cancels the operation. Just like when we modify the value of a memory record.

Thanks!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4715

PostPosted: Tue Sep 26, 2023 5:51 pm    Post subject: Reply with quote

Instead of calling `show` try `showModal`
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lontongmalam
Newbie cheater
Reputation: 0

Joined: 13 Apr 2022
Posts: 17

PostPosted: Tue Sep 26, 2023 6:14 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Instead of calling `show` try `showModal`


Thank you for your response.

I tried the showModal() method, and it appeared to work; however, it simply kept the form on top and did not prevent me from clicking on other forms.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4715

PostPosted: Tue Sep 26, 2023 7:11 pm    Post subject: Reply with quote

Sure, you can click on other windows, but that doesn't do anything. Mouse events are ignored AFAIK.
Other windows might get drawn on top. You can also try this:
Code:
f = createForm(false)
f.FormStyle = 'fsStayOnTop'
f.showModal()

Is there a form already in CE that behaves the way you want?

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lontongmalam
Newbie cheater
Reputation: 0

Joined: 13 Apr 2022
Posts: 17

PostPosted: Tue Sep 26, 2023 7:36 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Sure, you can click on other windows, but that doesn't do anything. Mouse events are ignored AFAIK.
Other windows might get drawn on top. You can also try this:
Code:
f = createForm(false)
f.FormStyle = 'fsStayOnTop'
f.showModal()

Is there a form already in CE that behaves the way you want?


For example, if you modify the description of a memory record, a window will appear, and this window will flash if we click on another CE area.



Q93QZsF - Imgur.gif
 Description:
 Filesize:  790.96 KB
 Viewed:  3459 Time(s)

Q93QZsF - Imgur.gif


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4715

PostPosted: Tue Sep 26, 2023 9:33 pm    Post subject: Reply with quote

All that does is call InputQuery. As far as I can see in lazarus's source, this uses showModal. You're doing something wrong.

Make sure the form isn't visible by default (i.e. the `false` argument I passed to createForm)- I previously made that mistake.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lontongmalam
Newbie cheater
Reputation: 0

Joined: 13 Apr 2022
Posts: 17

PostPosted: Tue Sep 26, 2023 11:41 pm    Post subject: Reply with quote

ParkourPenguin wrote:
All that does is call InputQuery. As far as I can see in lazarus's source, this uses showModal. You're doing something wrong.

Make sure the form isn't visible by default (i.e. the `false` argument I passed to createForm)- I previously made that mistake.


InputQuery only returns basic values with no other options; similarly to showSelectionList, it is not possible to add more functions.

So I discovered that this method makes use of the FlashWindow function available in the Windows API. There are various tutorials for using it on Lazarus, but I'm not sure how to use it on CE.



Screenshot 2023-09-27 123316.png
 Description:
Example Form
 Filesize:  6.26 KB
 Viewed:  3420 Time(s)

Screenshot 2023-09-27 123316.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25827
Location: The netherlands

PostPosted: Wed Sep 27, 2023 2:35 am    Post subject: Reply with quote

Code:

if not inMainThread() then messageDialog('You need to synchronize() this first',mtError) end

f=createForm(false)
b=createButton(f)
b.Caption='OK'
b.OnClick=function()
  f.ModalResult=mrOK
end
f.showModal()

_________________
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
View user's profile Send private message MSN Messenger
lontongmalam
Newbie cheater
Reputation: 0

Joined: 13 Apr 2022
Posts: 17

PostPosted: Wed Sep 27, 2023 8:11 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

if not inMainThread() then messageDialog('You need to synchronize() this first',mtError) end

f=createForm(false)
b=createButton(f)
b.Caption='OK'
b.OnClick=function()
  f.ModalResult=mrOK
end
f.showModal()


Thanks Dark Byte!

My mistake, this actually worked if I only conducted a correction from createForm(MainForm) to createForm(false), my form is not supposed to have an owner.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites