CLEO Help How to move a dialog?

CLEO related
Status
Not open for further replies.

MalikeiraOPoder

Active member
Joined
Mar 16, 2019
Messages
100
Reaction score
2
I want to know how can i move a Dialog.Create with CheckBox

Example: When i press in this CheckBox, i can move my textdraw and when i uncheck it, my dialog stay where i wanna..
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}
0000: NOP

REPEAT
   WAIT 0
UNTIL 0AFA:
                               
Dialog.Create(0@, "Hack Pack ")
Dialog.SetRECT(0@, 1@, 2@, 260, 150)
/// Dialog Background color
Dialog.SetBackgroundColor(0@, -16777216)
/// Dialog check Box
Dialog.AddCheckBox(0@, 1, "{FF0000}Test move dialog", 10, 10, 200, 20)
Dialog.AddButton(0@, 5, "Close", 80, 110, 70, 20)
/// Dialog minimize off
Dialog.SetMinimized(0@, 0)
/// Dialog CheckBox colors 
Dialog.SetCheckBoxColor(0@, 1, -15952405)
/// Dialog set not visibile
Dialog.SetVisible(0@,0)

0B34: "dialog" @ShowDialog

while true
   wait 0

if 0AAB: file_exists "CLEO\INI\Settings.ini"
then
   0AF0: 1@ getint "Cleo\INI\Settings.ini" section "DialogPosition" key "Positionxy"
   0AF0: 2@ getint "Cleo\INI\Settings.ini" section "DialogPosition" key "Positionz"
else
    //default postion
    1@ = 500
    2@ = 500
end
   if Dialog.IsVisible(0@)
   then
       SAMP.ToggleCursor(1) 
       if 0B81: dialog 0@ pop_event_to 2@ control_id_to 3@
       then
           if and
               3@ == 1
               0B92: dialog 0@ checkbox 3@ is_checked
           then
               //move dialog
               Dialog.GetRECT(0@, 3@, 4@, 5@, 6@)
               0B5E: get_cursor_pos 1@ 2@
               000C: 3@ -= 1@
               000C: 4@ -= 2@
               while 8B81: dialog 0@ pop_event_to $n control_id_to $n
                   wait 0
                   0B5E: get_cursor_pos 1@ 2@
                   000A: 1@ += 3@
                   000A: 2@ += 4@ 
                   Dialog.SetRECT(0@, 1@, 2@, 5@, 6@)
               end
               //save position, will auto create file if doesn't exist
               Dialog.GetRECT(0@, 3@, 4@, 5@, 6@)
               0AF1: write_int 3@ to_ini_file "Cleo\INI\Settings.ini" section "DialogPosition" key "Positionxy"
               0AF1: write_int 4@ to_ini_file "Cleo\INI\Settings.ini" section "DialogPosition" key "Positionz"
           end
           
           if and
               3@ == 5
               2@ == 257
           then
               Dialog.SetVisible(0@,0)
               SAMP.ToggleCursor(0)
           end
       end
   end
end

:ShowDialog
Dialog.SetVisible(0@, 1)
SAMP.ToggleCursor(1)
0B43:
 
Status
Not open for further replies.
Top