Ir para conteúdo
Fórum Script Brasil

Alan Castelan

Membros
  • Total de itens

    5
  • Registro em

  • Última visita

Tudo que Alan Castelan postou

  1. Tenho uma tabela cliente, e uma tabela endereço na minha tabela cliente tem as seguintes colunas Id, Nome, Ativo, Endereco_Id a coluna endereco_id é a chave de relacionameto com a tabela Endereço->id No meu Formulario tem os campos da tabela endereço e os campos da tabela cliente como eu faço para inserir os dois ao mesmo tempo, inserir o endereço digitado na tabela endereço e inserir o os dados do cliente na tabela cliente colocando já o id que foi gerado para o endereço na coluna Endereço id do cliente
  2. é javascript, não java... não tenho certeza e nunca programei em java, mas acho que java é um pouco diferente de javascript de site
  3. Tenho uma classe javascript mas não estou entendendo ela, segue o codigo abaixo preciso entende-la para reescrever o codigo em delphi eu não estou entendendo o que acontece em Fit, e o que é a variavel block.fit onde ela é declarada ? /****************************************************************************** Best results occur when the input blocks are sorted by height, or even better when sorted by max(width,height). Inputs: ------ w: width of target rectangle h: height of target rectangle blocks: array of any objects that have .w and .h attributes Outputs: ------- marks each block that fits with a .fit attribute pointing to a node with .x and .y coordinates Example: ------- var blocks = [ { w: 100, h: 100 }, { w: 100, h: 100 }, { w: 80, h: 80 }, { w: 80, h: 80 }, etc etc ]; var packer = new Packer(500, 500); packer.fit(blocks); for(var n = 0 ; n < blocks.length ; n++) { var block = blocks[n]; if (block.fit) { Draw(block.fit.x, block.fit.y, block.w, block.h); } } ******************************************************************************/ Packer = function(w, h) { this.init(w, h); }; Packer.prototype = { init: function(w, h) { this.root = { x: 0, y: 0, w: w, h: h }; }, fit: function(blocks) { var n, node, block; for (n = 0; n < blocks.length; n++) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)){ block.fit = this.splitNode(node, block.w, block.h); } } }, findNode: function(root, w, h) { if (root.used) return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); else if ((w <= root.w) && (h <= root.h)) return root; else return null; }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; } }
  4. Preciso do código em delphi....não q o delphi rode o código javascript
  5. Tenho este código em javascript e estou tentando passar ele para o delphi alguém pode me ajudar?? o código no java e este Packer = function(w, h) { this.root = { x: 0, y: 0, w: w, h: h }; }; Packer.prototype = { fit: function(blocks) { var n, node, block; for (n = 0; n < blocks.length; n++) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)) block.fit = this.splitNode(node, block.w, block.h); } }, findNode: function(root, w, h) { if (root.used) return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); else if ((w <= root.w) && (h <= root.h)) return root; else return null; }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; } }
×
×
  • Criar Novo...