Custom InputBox

Tutorial, videotutorials ed esempi creati da noi
Rispondi
Avatar utente
Xxshark888xX
Membro d'elite
Messaggi: 1497
Iscritto il: 30/05/2012, 19:17
Specialità: Un poco di tutto
Uso: GM:Studio 1.4 Pro
Località: Earth
Contatta:

Custom InputBox

Messaggio da Xxshark888xX »

Salve! :cappa:

Ho creato uno script che semplifica di molto la creazione di una InputBox...

Si può completamente personalizzare con poche righe di codice! Ora posso dire che è completa al 100%. Per ora lascio così lo script, forse più avanti lo migliorerò, ma ho sistemato tutti i bugs, come ad esempio se in una InputBox multilinea si inseriva un testo super lungo, questo usciva fuori dai bordi. Se si inserisce un testo super lungo in una InputBox a linea singola e questa stringa ha spazi "a capo" (chr(10) o chr(13)) potrebbe volerci un poco prima che appaia il testo formattato... Il resto funge benissimo, solo che non si può selezionare il testo o spostare il PipeSymbol.

Script: inpbCreate();
Spoiler

Codice: Seleziona tutto

/* Script created by Xxshark888xX - (c)2014 (Free for use)

 \\ USE: inpbCreate(x,y,w,h,pipeSymbol,pipeTimer,integerOnly,multiLines,readOnly); //

** inpbX : X coordinates of the inputbox
** inpbY : Y coordinates of the inputbox
** inpbW : Width of the inputbox
** inpbH : Height of the inputbox
** inpbTextIntegerOnly : Only integer text input
** inpbMultiLines : Wrapping text
** inpbReadOnly : Read only inputbox (You can change the text through code)

** inpbMouseOn : Check if the mouse is on the inputbox | DEFAULT = false
** inpbTextCanType : Check if the user can type in the inputbox | DEFAULT = false
** inpbTextWriteInterval : Interval to press for writing | DEFAULT = 2
** inpbTextMaxLength : The maxim length of the text | DEFAULT = 9999999999999999
** inpbText : The full text of the inputbox | DEFAULT = ""
** inpbTextDraw : The drawed text of the inputbox | DEFAULT = ""
** inpbTextPipeSymbol : The pipe symbol
** inpbTextTabPressedSpaces : Spaces to add when is pressed Tab | DEFAULT = 4
** inpbTextCharReplace : Replace a char or a word - Example: inpbTextCharReplace = "PASSWORD|*"; | DEFAULT = NULL
** inpbTextCharReplaceAll : Replace all chars - Example: inpbTextCharReplaceAll = '*'; | DEFAULT = NULL
** inpbTextFont : The text font of the inputbox | DEFAULT = ""
** inpbTextHalign : The horizontal text halign of the inputbox | DEFAULT = fa_left
** inpbTextColor : The text color | DEFAULT = c_black
** inpbTextColorDisabled : The text color of the inputbox disabled | DEFAULT = make_color_rgb(85,85,85)
** inpbBackgroundColor : The background color of the inputbox | DEFAULT = make_color_rgb(242,242,242)
** inpbNormalOutlineColor : The normal outline color of the inputbox | DEFAULT = make_color_rgb(209,209,209)
** inpbOnOutlineColor : The mouse enter outline color of the inputbox | DEFAULT = make_color_rgb(181,181,181)
** inpbSelectedOutlineColor : The selected outline color of the inputbox | DEFAULT = make_color_rgb(140,0,255)
** inpbNormalOutlineColorDisabled : The normal outline color of the inputbox disabled | DEFAULT = make_color_rgb(145,145,145)
** inpbOnOutlineColorDisabled : The mouse enter outline color of the inputbox disabled | DEFAULT = make_color_rgb(145,145,145)
** inpbBackgroundColorDisabled : The background color of the inputbox disabled | DEFAULT = make_color_rgb(219,219,219)
** inpbClipBoardPaste : The text of the Paste button
** inpbClipBoardCopyAll : The text of the Copy all button
** inpbClipBoardDeleteAll : The text of the Delete all button

*/


// !START - VARIABLES! \\

 //*** !START - DEFAULT VARIABLES! ***\\
if (!variable_local_exists("inpbX")) {
     inpbX = argument0; inpbY = argument1; inpbW = argument2; inpbH = argument3; inpbTextIntegerOnly = argument6; inpbMultiLines = argument7; inpbReadOnly = argument8; 
     
     inpbMouseOn = false; inpbTextCanType = false; inpbMouseCursorChange = false;  inpbTextPipeTimer = 0; inpbTextPipeSymbol = argument4;
}
 //*** !END - DEFAULT VARIABLES! ***\\

 //*** !START - USER VARIABLES! ***\\
if (!variable_local_exists("inpbTextMaxLength")) {
     inpbTextMaxLength = 9999999999999999;
}

if (!variable_local_exists("inpbTextWriteInterval")) {
     inpbTextWriteInterval = 2;
}
 
if (!variable_local_exists("inpbText")) {
     inpbText = "";
} 

if (!variable_local_exists("inpbTextDraw")) {
    inpbTextDraw = inpbText;
}

if (!variable_local_exists("inpbTextCanTypeMultiLines")) {
    inpbTextCanTypeMultiLines = false;
}

if (!variable_local_exists("inpbTextTabPressedSpaces")) {
    inpbTextTabPressedSpaces = 4;
}

if (!variable_local_exists("inpbTextDrawLast")) {
    inpbTextDrawLast = "";
}

if (!variable_local_exists("inpbTextButtonPressed")) {
     inpbTextButtonPressed = 0;
} 

if (!variable_local_exists("inpbTextTimer")) {
     inpbTextTimer = 0;
} 

if (!variable_local_exists("inpbTextCharReplace")) {
     inpbTextCharReplace = "";
}

if (!variable_local_exists("inpbTextCharReplaceAll")) {
     inpbTextCharReplaceAll = "";
}

if (!variable_local_exists("inpbTextFont")) {
     inpbTextFont = "";
}

if (!variable_local_exists("inpbTextHalign")) {
     inpbTextHalign = fa_left;
}

if (!variable_local_exists("inpbTextColor")) {
     inpbTextColor = c_black;
}

if (!variable_local_exists("inpbBackgroundColor")) {
     inpbBackgroundColor = make_color_rgb(242,242,242);
}

if (!variable_local_exists("inpbNormalOutlineColor")) {
     inpbNormalOutlineColor = make_color_rgb(209,209,209);
}

if (!variable_local_exists("inpbOnOutlineColor")) {
     inpbOnOutlineColor = make_color_rgb(181,181,181);
}

if (!variable_local_exists("inpbSelectedOutlineColor")) {
     inpbSelectedOutlineColor = make_color_rgb(140,0,255);
}

if (!variable_local_exists("inpbClipBoardPaste")) {
     inpbClipBoardPaste = "Paste";
}

if (!variable_local_exists("inpbClipBoardCopyAll")) {
     inpbClipBoardCopyAll = "Copy all";
}

if (!variable_local_exists("inpbClipBoardDeleteAll")) {
     inpbClipBoardDeleteAll = "Delete all";
}

// ***START - INPUTBOX DISABLED*** \\
if (!variable_local_exists("inpbTextColorDisabled")) {
     inpbTextColorDisabled = make_color_rgb(85,85,85);
}

if (!variable_local_exists("inpbNormalOutlineColorDisabled")) {
     inpbNormalOutlineColorDisabled = make_color_rgb(145,145,145);
}

if (!variable_local_exists("inpbOnOutlineColorDisabled")) {
     inpbOnOutlineColorDisabled = make_color_rgb(145,145,145);
}

if (!variable_local_exists("inpbBackgroundColorDisabled")) {
     inpbBackgroundColorDisabled = make_color_rgb(219,219,219);
}
// ***END - INPUTBOX DISABLED**\\

if (!variable_local_exists("inpbMouseCursorNormal")) {
     inpbMouseCursorNormal = cr_default;
}

if (!variable_local_exists("inpbMouseCursorOn")) {
     inpbMouseCursorOn = cr_beam;
}
 //*** !END - USER VARIABLES! ***\\

// !END - VARIABLES! \\




 
// !START - MOUSE CHECKS! \\

 //*** !START - MOUSE ENTER/MOUSE LEAVE! ***\\
if (mouse_x >= inpbX && mouse_x <= inpbX+inpbW && mouse_y >= inpbY && mouse_y <= inpbY+inpbH) { 
     if (inpbReadOnly == false) {
          inpbMouseOn = true; 
          window_set_cursor(inpbMouseCursorOn);
     } else {
          window_set_cursor(inpbMouseCursorNormal);
 }
} else {
     inpbMouseOn = false; 
}

if (inpbMouseOn == true) {
  //*** !START - DRAW THE INPUTBOX [On Outline Color]! ***\\
     if (inpbReadOnly == false) {
          draw_set_color(inpbOnOutlineColor) { 
               draw_rectangle(inpbX,inpbY,inpbX+inpbW,inpbY+inpbH,1);
  }
  } else {
       draw_set_color(inpbOnOutlineColorDisabled) { 
            draw_rectangle(inpbX,inpbY,inpbX+inpbW,inpbY+inpbH,1);
 }
  }

  //*** !END - DRAW THE INPUTBOX [On Outline Color]! ***\\

  //*** !START - MOUSE RIGHT BUTTON PRESSED! ***\\
 if (mouse_check_button_pressed(mb_right)) { inpbTextCanType = true; inpbTextCanTypeMultiLines = true;
     switch (show_menu(inpbClipBoardPaste + "|" + inpbClipBoardCopyAll + "|" + inpbClipBoardDeleteAll,3)) {
         case 0 : 
         if (inpbTextIntegerOnly == false) {
             inpbText += clipboard_get_text(); inpbTextDraw += clipboard_get_text();
         } else {
             inpbText += string_digits(clipboard_get_text()); inpbTextDraw += string_digits(clipboard_get_text());
         } break;
         case 1 : clipboard_set_text(inpbText); break;
         case 2 : inpbText = string_delete(inpbText,1,string_length(inpbText)); inpbTextDraw = string_delete(inpbTextDraw,1,string_length(inpbTextDraw)); inpbTextDrawLast = string_delete(inpbTextDrawLast,1,string_length(inpbTextDrawLast)); break;
         case 3 : break;
     }
 }
 //*** !END - MOUSE RIGHT BUTTON PRESSED! ***\\
  
 if (inpbMouseCursorChange == false) {
      window_set_cursor(inpbMouseCursorOn);
      inpbMouseCursorChange = true;
 } 
 
  //*** !START - MOUSE LEFT BUTTON PRESSED! ***\\
 if (mouse_check_button_pressed(mb_left)) { 
      inpbTextCanType = true; inpbTextCanTypeMultiLines = true;
 }
  //*** !END - MOUSE LEFT BUTTON PRESSED! ***\\
} else {
  //*** !START - DRAW THE INPUTBOX [Normal Outline Color]! ***\\
     if (inpbReadOnly == false) {
     draw_set_color(inpbNormalOutlineColor) { 
         draw_rectangle(inpbX,inpbY,inpbX+inpbW,inpbY+inpbH,1);
  }
 } else {
     draw_set_color(inpbNormalOutlineColorDisabled) { 
          draw_rectangle(inpbX,inpbY,inpbX+inpbW,inpbY+inpbH,1);
 }
 }
  //*** !END - DRAW THE INPUTBOX [Normal Outline Color]! ***\\

 if (inpbMouseCursorChange == true) {
      window_set_cursor(inpbMouseCursorNormal);
      inpbMouseCursorChange = false;
 }
 if (mouse_check_button_pressed(mb_left)) {
      inpbTextCanType = false;
 }
}
 //*** !END - MOUSE ENTER/MOUSE LEAVE! ***\\
 
// !END - MOUSE CHECKS! \\
 
 



// !START - DRAW THE INPUTBOX [Background]! \\

if (inpbReadOnly == false) {
     draw_set_color(inpbBackgroundColor) { 
          draw_rectangle(inpbX+1,inpbY+1,inpbX+inpbW,inpbY+inpbH,0); 
 }
} else {
     draw_set_color(inpbBackgroundColorDisabled) { 
          draw_rectangle(inpbX+1,inpbY+1,inpbX+inpbW,inpbY+inpbH,0);
  }
}

// !END - DRAW THE INPUTBOX [Background]! \\





// !START - CAN TYPE CHECKS! \\
 
if (inpbTextCanType == true) {
  //*** !START - DRAW THE INPUTBOX [Pressed Outline Color]! ***\\
 if (inpbReadOnly == false) {
  draw_set_color(inpbSelectedOutlineColor) { 
   draw_rectangle(inpbX,inpbY,inpbX+inpbW,inpbY+inpbH,1); 
  }
 }
  //*** !END - DRAW THE INPUTBOX [Pressed Outline Color]! ***\\

 if (inpbTextPipe == "" || inpbTextPipe == inpbTextPipeSymbol) {
      inpbTextPipeTimer += 1;
  }
 if (inpbTextPipeTimer == room_speed*argument5) {
      if (inpbTextPipe == "") {
           inpbTextPipe = inpbTextPipeSymbol; 
   } else if (inpbTextPipe == inpbTextPipeSymbol) {
        inpbTextPipe = ""; 
   }
 inpbTextPipeTimer = 0;
  }
  
  if (keyboard_check_pressed(vk_anykey)) {
      inpbTextButtonPressed = 1;
      if (keyboard_check(vk_backspace)) { inpbTextCanTypeMultiLines = true;
          if (string_char_at(inpbText,string_length(inpbText)) == "#") {
              inpbText = string_delete(inpbText,string_length(inpbText)-1,2); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw)-1,2);
          } else {
              inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
          } 
          if (string_width(inpbTextDraw) + string_width(keyboard_lastchar) + string_width(inpbTextPipeSymbol) < inpbW && inpbMultiLines == false) { 
              inpbTextDraw = string_insert(string_copy(inpbTextDrawLast,string_length(inpbTextDrawLast),1),inpbTextDraw,1); inpbTextDrawLast = string_delete(inpbTextDrawLast,string_length(inpbTextDrawLast),1);
          }
      } else if !(keyboard_check_pressed(vk_control) || keyboard_check_pressed(vk_alt)) {
              if (inpbTextIntegerOnly == false) {
                  inpbText += keyboard_lastchar;
                  inpbTextDraw += keyboard_lastchar;
              } else {
                  inpbText += string_digits(keyboard_lastchar); inpbTextDraw += string_digits(keyboard_lastchar);
                }
          
          
               if (keyboard_check_pressed(20)) { //Caps
                  inpbText = string_delete(inpbText,string_length(inpbText),1);
                  inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
               }
          
               if (keyboard_check_pressed(vk_tab)) {
                   if (!variable_local_exists("inpbTabBefore")) {
                       inpbTabBefore = 0;
                   }
 
                   inpbText = string_delete(inpbText,string_length(inpbText),1);
                   inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                   
                   if (inpbTabBefore == 0) {
                       inpbText += " "; inpbTextDraw += " ";
                       inpbTabBefore = 1;
                   } else if (inpbTabBefore == 1) {
                       inpbText += "  "; inpbTextDraw += "  ";
                       inpbTabBefore = 2;
                   } else if (inpbTabBefore == 2) {
                       inpbText += string_repeat(" ",inpbTextTabPressedSpaces); inpbTextDraw += string_repeat(" ",inpbTextTabPressedSpaces);
                   }
               }
               
               if (keyboard_check_pressed(vk_shift)) {
                  inpbText = string_delete(inpbText,string_length(inpbText),1);
                  inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
               }
               
               if (keyboard_check(vk_enter)) {
                   if (inpbMultiLines == false) {
                       inpbText = string_delete(inpbText,string_length(inpbText),1);
                       inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                   } else {
                       if !(string_height(inpbTextDraw) + string_height(chr(13)) < inpbH) {
                           inpbText = string_delete(inpbText,string_length(inpbText),1);
                           inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                       }
                   }
               }
               
               if (keyboard_lastchar == "#") {
                   inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                   inpbText += "\#"; inpbTextDraw += "\#";
               }
   }
 }
  
  if (keyboard_check(vk_anykey)) {
      if (inpbTextButtonPressed == 1) {
          inpbTextTimer += 0.1;
          
          if (inpbTextTimer >= inpbTextWriteInterval) {
              if (keyboard_check(vk_backspace)) {
                  if (string_char_at(inpbText,string_length(inpbText)) == "#") {
                      inpbText = string_delete(inpbText,string_length(inpbText)-1,2); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw)-1,2);
                  }  else {
                      inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                  } 
                  if (string_width(inpbTextDraw) + string_width(keyboard_lastchar) + string_width(inpbTextPipeSymbol) < inpbW && inpbMultiLines == false) { 
                      inpbTextDraw = string_insert(string_copy(inpbTextDrawLast,string_length(inpbTextDrawLast),1),inpbTextDraw,1); inpbTextDrawLast = string_delete(inpbTextDrawLast,string_length(inpbTextDrawLast),1);
                  }
              } else if !(keyboard_check(vk_control) || keyboard_check(vk_alt)) {
                      if (inpbTextIntegerOnly == false) {
                          inpbText += keyboard_lastchar;
                          inpbTextDraw += keyboard_lastchar;
                      } else {
                          inpbText += string_digits(keyboard_lastchar); inpbTextDraw += string_digits(keyboard_lastchar);
                      }
                  
                  
          
                      if (keyboard_check(20)) { //Caps
                          inpbText = string_delete(inpbText,string_length(inpbText),1);
                          inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                      }
          
                      if (keyboard_check_pressed(vk_tab)) {
                          inpbText = string_delete(inpbText,string_length(inpbText),1);
                          inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
      
                          inpbText += string_repeat(" ",inpbTextTabPressedSpaces); inpbTextDraw += string_repeat(" ",inpbTextTabPressedSpaces);
                      }
          
                      if (keyboard_check(vk_shift)) {
                          inpbText = string_delete(inpbText,string_length(inpbText),1);
                          inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                      }
              
                      if (keyboard_check(vk_enter)) {
                          if (inpbMultiLines == false) {
                              inpbText = string_delete(inpbText,string_length(inpbText),1);
                              inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                          } else {
                              if !(string_height(inpbTextDraw) + string_height(chr(13)) < inpbH) {
                                  inpbText = string_delete(inpbText,string_length(inpbText),1);
                                  inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                              }
                          }
                      }
                      
                      if (keyboard_check_pressed(17)) { //Ctrl
                          if (string_char_at(inpbTextDraw,string_length(inpbTextDraw)) == "#") {
                              inpbText = string_delete(inpbText,string_length(inpbText)-1,2); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw)-1,2);
                          } else {
                              inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                          }
                      }
                      
                      if (keyboard_check_pressed(vk_alt)) {
                          if (string_char_at(inpbTextDraw,string_length(inpbTextDraw)) == "#") {
                              inpbText = string_delete(inpbText,string_length(inpbText)-1,2); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw)-1,2);
                          } else {
                              inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                          }
                      }
              
                      if (keyboard_lastchar == "#") {
                          inpbText = string_delete(inpbText,string_length(inpbText),1); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDraw),1);
                          inpbText += "\#"; inpbTextDraw += "\#";
                      }
          }
      }
  }
 }
  
  if (keyboard_check_released(vk_anykey)) {
      inpbTextButtonPressed = 0; inpbTextTimer = 0;
  }
  
  
} else {
    inpbTextPipe = ""; 
}

// !END - CAN TYPE CHECKS! \\




// !START - TEXT IN INPUTBOX! \\

for (inpbTextDrawLastLength = 0; inpbTextDrawLastLength <= string_length(inpbTextDraw); inpbTextDrawLastLength += 1) {
    if (inpbMultiLines == false) { inpbText = string_replace_all(inpbText,chr(13)+chr(10),""); inpbTextDraw = string_replace_all(inpbTextDraw,chr(13)+chr(10),"");
        if (string_width(inpbTextDraw) +2 >= inpbW) {
            inpbTextDrawLast += string_copy(inpbTextDraw,0,1); inpbTextDraw = string_delete(inpbTextDraw,1,1);
        }
    } else { inpbTextDrawLast = string_copy(inpbTextDraw,1,inpbTextDrawLastLength);
        if (string_width(inpbTextDrawLast) +2 + string_width(inpbTextPipeSymbol) > inpbW) {
            inpbText = string_insert(chr(13),inpbText,inpbTextDrawLastLength); inpbTextDraw = string_insert(chr(13),inpbTextDraw,inpbTextDrawLastLength);
        } else if (string_height(inpbTextDrawLast) > inpbH) {
            inpbText = string_delete(inpbText,string_length(inpbTextDrawLast)-2,string_length(inpbText)); inpbTextDraw = string_delete(inpbTextDraw,string_length(inpbTextDrawLast)-2,string_length(inpbTextDraw));
        }
    }
} 
if (string_length(inpbText) > inpbTextMaxLength) {
    inpbText = string_delete(inpbText,inpbTextMaxLength+1,string_length(inpbText)); inpbTextDraw = string_delete(inpbTextDraw,inpbTextMaxLength+1,string_length(inpbTextDraw)); 
}
           
// !END - TEXT IN INPUTBOX! \\





// !START - CHAR REPLACE! \\

if (inpbTextCharReplace != "") {
     var inpb1Char, inpb2Char; inpb1Char = string_copy(inpbTextCharReplace,0,string_pos("|",inpbTextCharReplace)); inpb1Char = string_delete(inpb1Char,string_length(inpb1Char),1) inpb2Char = string_copy(inpbTextCharReplace,string_length(inpbTextCharReplace),1);
     inpbTextDraw = string_replace_all(inpbTextDraw ,inpb1Char,string_repeat(inpb2Char,string_length(inpb1Char)));
}
if (inpbTextCharReplaceAll != "") {
     inpbTextDraw = string_repeat(inpbTextCharReplaceAll,string_length(inpbTextDraw));
}

// !END - CHAR REPLACE! \\
 
// !START - DRAW TEXT! \\
draw_set_font(inpbTextFont) {
     if (inpbReadOnly == false) {
         draw_set_color(inpbTextColor);
     } else {
         draw_set_color(inpbTextColorDisabled);
     }
  // Align left
  if (inpbTextHalign == fa_left) {
       draw_set_halign(fa_left) {
           draw_text(inpbX+2,inpbY+1,inpbTextDraw + inpbTextPipe); 
       } 
  }
    
  // Align center  
  if (inpbTextHalign == fa_center) {
       draw_set_halign(fa_center) {
           draw_text(inpbX+inpbW/2,inpbY+1,inpbTextDraw + inpbTextPipe); 
       } 
  }
    
  // Align right
  if (inpbTextHalign == fa_right) {
       draw_set_halign(fa_right) {
           draw_text(inpbX+inpbW-2,inpbY+1,inpbTextDraw + inpbTextPipe); 
       }
  } 

} draw_set_halign(fa_left);
  
// !END - DRAW TEXT! \\
Messo lo script, create un nuovo object, ad esempio "nicknameInputBox_obj" e nel "Draw event" mettete

Codice: Seleziona tutto

inpbCreate(x,y,w,h,pipeSymbol,pipeTimer,integerOnly,multiLines,readOnly);
Avviate il gioco e walà!

Ecco le funzioni per il controllo e la modifica della InputBox:
Spoiler
inpbX : X coordinates of the inputbox
inpbY : Y coordinates of the inputbox
inpbW : Width of the inputbox
inpbH : Height of the inputbox
inpbTextIntegerOnly : Only integer text input
inpbMultiLines : Wrapping text
inpbReadOnly : Read only inputbox (You can change the text through code)

inpbMouseOn : Check if the mouse is on the inputbox
inpbTextCanType : Check if the user can type in the inputbox
inpbTextWriteInterval : Interval to press for writing
inpbTextMaxLength : The maxim length of the text
inpbText : The full text of the inputbox
inpbTextDraw : The drawed text of the inputbox
inpbTextPipeSymbol : The pipe symbol
inpbTextTabPressedSpaces : Spaces to add when is pressed Tab
inpbTextCharReplace : Replace a char or a word - Example: inpbTextCharReplace = "PASSWORD|*";
inpbTextCharReplaceAll : Replace all chars - Example: inpbTextCharReplaceAll = '*';
inpbTextFont : The text font of the inputbox
inpbTextHalign : The horizontal text halign of the inputbox
inpbTextColor : The text color
inpbBackgroundColor : The background color of the inputbox
inpbNormalOutlineColor : The normal outline color of the inputbox
inpbOnOutlineColor : The mouse enter outline color of the inputbox
inpbSelectedOutlineColor : The selected outline color of the inputbox
inpbNormalOutlineColorDisabled : The normal outline color of the inputbox disabled
inpbOnOutlineColorDisabled : The mouse enter outline color of the inputbox disabled
inpbBackgroundColorDisabled : The background color of the inputbox disabled
inpbClipBoardPaste : The text of the Paste button
inpbClipBoardCopyAll : The text of the Copy all button
inpbClipBoardDeleteAll : The text of the Delete all button
Alcuni controlli come inpbTextCanType vanno fatti dopo inpbCreate().

GM8.1 + .exe : https://www.dropbox.com/s/kofqssgaz1h5l ... k888xX.rar
Ultima modifica di Xxshark888xX il 11/06/2014, 18:50, modificato 3 volte in totale.
Contatti
Steam
Facebook

Gif
Spoiler
Immagine
Immagine
Immagine
Immagine

Avatar utente
Xxshark888xX
Membro d'elite
Messaggi: 1497
Iscritto il: 30/05/2012, 19:17
Specialità: Un poco di tutto
Uso: GM:Studio 1.4 Pro
Località: Earth
Contatta:

Re: Custom InputBox

Messaggio da Xxshark888xX »

Xeryan ha scritto:95% uhm e già trovo bug come premere # e va a capo oppure control che mette spazi e caratteri a caso, non c'è la selezione del testo (e relativi shortcuts) e il multilinea mi pare fatto con un semplice draw_text_ext o comunque fatto male (non deve basarsi sulla presenza di spazi ma sulla larghezza della stringa in quella riga), il non poter uscire fuori dalla textbox è fondamentale e manca quindi anche poter andare avanti e indietro con le freccette (o magari anche col mouse) mostrando solo la parte interessata
:asd: mi sono dimenticato di aggiungere il controllo sulla rimozione del '#'. Il multilinea per ora non c'è proprio, il draw_ext ho dimenticato di toglierlo... Le altre cose le aggiungo quando sistemo il bug principale...
Contatti
Steam
Facebook

Gif
Spoiler
Immagine
Immagine
Immagine
Immagine

Avatar utente
Xxshark888xX
Membro d'elite
Messaggi: 1497
Iscritto il: 30/05/2012, 19:17
Specialità: Un poco di tutto
Uso: GM:Studio 1.4 Pro
Località: Earth
Contatta:

Re: Custom InputBox

Messaggio da Xxshark888xX »

Versione 1.1. Ho sistemato molte cose, ora è utilizzabile anche se devo ancora implementare altre cosucce :sisisi:
Contatti
Steam
Facebook

Gif
Spoiler
Immagine
Immagine
Immagine
Immagine

Avatar utente
Xxshark888xX
Membro d'elite
Messaggi: 1497
Iscritto il: 30/05/2012, 19:17
Specialità: Un poco di tutto
Uso: GM:Studio 1.4 Pro
Località: Earth
Contatta:

Re: Custom InputBox

Messaggio da Xxshark888xX »

Uscita la versione finale 1.2. :rockrock:
Contatti
Steam
Facebook

Gif
Spoiler
Immagine
Immagine
Immagine
Immagine

Avatar utente
Xxshark888xX
Membro d'elite
Messaggi: 1497
Iscritto il: 30/05/2012, 19:17
Specialità: Un poco di tutto
Uso: GM:Studio 1.4 Pro
Località: Earth
Contatta:

Re: Custom InputBox

Messaggio da Xxshark888xX »

Xeryan ha scritto:
Xxshark888xX ha scritto:Uscita la versione finale 1.2. :rockrock:
modifiche fatte?
Leggi nel post iniziale...
Contatti
Steam
Facebook

Gif
Spoiler
Immagine
Immagine
Immagine
Immagine

Rispondi

Chi c’è in linea

Visitano il forum: Nessuno e 6 ospiti